<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>schema &#8211; Solr.pl</title>
	<atom:link href="https://solr.pl/en/tag/schema-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://solr.pl/en/</link>
	<description>All things to be found - Blog related to Apache Solr &#38; Lucene projects - https://solr.apache.org</description>
	<lastBuildDate>Thu, 12 Nov 2020 12:59:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>Solr 4.2: Index structure reading API</title>
		<link>https://solr.pl/en/2013/05/20/solr-4-2-index-structure-reading-api/</link>
					<comments>https://solr.pl/en/2013/05/20/solr-4-2-index-structure-reading-api/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 20 May 2013 11:58:51 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[4.2]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[schema api]]></category>
		<category><![CDATA[schema.xml]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[structure]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=554</guid>

					<description><![CDATA[With the release of Solr 4.2 we&#8217;ve got the possibility to use the HTTP protocol to get information about Solr index structure. Of course, if one wanted to do that prior to Solr 4.2 it could be achieved by fetching]]></description>
										<content:encoded><![CDATA[<p>With the release of Solr 4.2 we&#8217;ve got the possibility to use the HTTP protocol to get information about Solr index structure. Of course, if one wanted to do that prior to Solr 4.2 it could be achieved by fetching the <em>schema.xml</em> file, parsing it and then getting the needed information. However when Solr 4.2 was released we&#8217;ve got a dedicated API which can return the information we need without the need of parsing the whole <em>schema.xml</em> file.</p>
<p><span id="more-554"></span></p>
<h3>Possibilities</h3>
<p>Let&#8217;s look at the new API by example.</p>
<h4>Getting information in XML format</h4>
<p>Many Solr users are used to getting their data in the XML format, at least when using Solr HTTP API. However, the schema API uses JSON as the default format. In order to get the data in the XML format in all the below examples, you&#8217;ll need to appeng the <em>wt=xml</em> parameter to the call, for example like that:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/fieldtypes?wt=xml'</pre>
<h4>Defined fields information</h4>
<p>Let&#8217;s start by looking at how to fetch information about the fields that are defined in Solr. In order to do that we have the following possibilities:</p>
<ol>
<li>Get information about all the fields defined in the index</li>
<li>Get information for a one, explicitly defined field</li>
</ol>
<p>In the first case we should use the following command:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/fields'</pre>
<p>In second case we should add the <em>/</em> character and the field name to the above command. For example in order to get the information about the <em>author</em> field we should use the following command:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/fields/author'</pre>
<p>Solr response for the first command will be similar to the following one:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "fields":[{
      "name":"_version_",
      "type":"long",
      "indexed":true,
      "stored":true},
    {
      "name":"author",
      "type":"text_general",
      "indexed":true,
      "stored":true},
    {
      "name":"cat",
      "type":"string",
      "multiValued":true,
      "indexed":true,
      "stored":true},
    {
      "name":"category",
      "type":"text_general",
      "indexed":true,
      "stored":true},
    {
      "name":"id",
      "type":"string",
      "multiValued":false,
      "indexed":true,
      "required":true,
      "stored":true,
      "uniqueKey":true},
    {
      "name":"url",
      "type":"text_general",
      "indexed":true,
      "stored":true},
    {
      "name":"weight",
      "type":"float",
      "indexed":true,
      "stored":true}]}</pre>
<p>On the other hand the response for the second command would be as follows:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":0},
  "field":{
    "name":"author",
    "type":"text_general",
    "indexed":true,
    "stored":true}}</pre>
<h4>Getting information about defined dynamic fields</h4>
<p>Similar to what information we can get about the fields defined in the <em>schema.xml</em> we can get the information about dynamic fields. Again we have to options:</p>
<ol>
<li>Get information about all dynamic fields</li>
<li>Get information about specific dynamic field pattern</li>
</ol>
<p>In order to get all the information about dynamic fields we should use the following command:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/dynamicfields'</pre>
<p>In order to get information about a specific pattern we append the <em>/&nbsp;</em>character followed by the pattern, for example like this:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/dynamicfields/random_*'</pre>
<p>Solr will return the following response for the first query:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":2},
  "dynamicfields":[{
      "name":"*_coordinate",
      "type":"tdouble",
      "indexed":true,
      "stored":false},
    {
      "name":"ignored_*",
      "type":"ignored",
      "multiValued":true},
    {
      "name":"random_*",
      "type":"random"},
    {
      "name":"*_p",
      "type":"location",
      "indexed":true,
      "stored":true},
    {
      "name":"*_c",
      "type":"currency",
      "indexed":true,
      "stored":true}]}</pre>
<p>And the following response will be returned for the second command:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "dynamicfield":{
    "name":"random_*",
    "type":"random"}}</pre>
<h4>Getting field types</h4>
<p>As you probably guess, in a way similar to the above describes examples, we can also get the information about the field types defined in our <em>schema.xml</em> files. We can fetch the following information:</p>
<ol>
<li>All the field types defined in the <em>schema.xml</em> file</li>
<li>A single type</li>
</ol>
<p>To get all the defined field types we should run the following command:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/fieldtypes'</pre>
<p>The get information about a single type we should again add the <em>/</em> character and append the field type name to it, for example like this:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/fieldtypes/text_gl'</pre>
<p>Solr will return the following information in response to the first command:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":3},
  "fieldTypes":[{
      "name":"alphaOnlySort",
      "class":"solr.TextField",
      "sortMissingLast":true,
      "omitNorms":true,
      "analyzer":{
        "class":"solr.TokenizerChain",
        "tokenizer":{
          "class":"solr.KeywordTokenizerFactory"},
        "filters":[{
            "class":"solr.LowerCaseFilterFactory"},
          {
            "class":"solr.TrimFilterFactory"},
          {
            "class":"solr.PatternReplaceFilterFactory",
            "replace":"all",
            "replacement":"",
            "pattern":"([^a-z])"}]},
      "fields":[],
      "dynamicFields":[]},
    {
      "name":"boolean",
      "class":"solr.BoolField",
      "sortMissingLast":true,
      "fields":["inStock"],
      "dynamicFields":["*_bs",
        "*_b"]},
    {
      "name":"text_gl",
      "class":"solr.TextField",
      "positionIncrementGap":"100",
      "analyzer":{
        "class":"solr.TokenizerChain",
        "tokenizer":{
          "class":"solr.StandardTokenizerFactory"},
        "filters":[{
            "class":"solr.LowerCaseFilterFactory"},
          {
            "class":"solr.StopFilterFactory",
            "words":"lang/stopwords_gl.txt",
            "ignoreCase":"true",
            "enablePositionIncrements":"true"},
          {
            "class":"solr.GalicianStemFilterFactory"}]},
      "fields":[],
      "dynamicFields":[]},
    {
      "name":"tlong",
      "class":"solr.TrieLongField",
      "precisionStep":"8",
      "positionIncrementGap":"0",
      "fields":[],
      "dynamicFields":["*_tl"]}]}</pre>
<p>In response to the second command Solr will return the following:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":2},
  "fieldType":{
    "name":"text_gl",
    "class":"solr.TextField",
    "positionIncrementGap":"100",
    "analyzer":{
      "class":"solr.TokenizerChain",
      "tokenizer":{
        "class":"solr.StandardTokenizerFactory"},
      "filters":[{
          "class":"solr.LowerCaseFilterFactory"},
        {
          "class":"solr.StopFilterFactory",
          "words":"lang/stopwords_gl.txt",
          "ignoreCase":"true",
          "enablePositionIncrements":"true"},
        {
          "class":"solr.GalicianStemFilterFactory"}]},
    "fields":[],
    "dynamicFields":[]}}</pre>
<p>As you can see, the amount information is nice as we are getting all the information about the field types and in addition to that the information which field are using give field (both dynamic and non-dynamic.</p>
<h4>Retrieving information about copyFields</h4>
<p>In addition to what we&#8217;ve discussed so far we are able to get information about copyFields section from the <em>schema.xml</em>. In order to do that one should run the following command:
</p>
<pre class="brush:bash">$curl 'http://localhost:8983/solr/collection1/schema/copyfields'</pre>
<p>And in response we will get the following data:
</p>
<pre class="brush:plain">{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "copyfields":[{
      "source":"author",
      "dest":"text"},
    {
      "source":"cat",
      "dest":"text"},
    {
      "source":"content",
      "dest":"text"},
    {
      "source":"content_type",
      "dest":"text"},
    {
      "source":"description",
      "dest":"text"},
    {
      "source":"features",
      "dest":"text"},
    {
      "source":"author",
      "dest":"author_s",
      "destDynamicBase":"*_s"}]}</pre>
<h3>The future</h3>
<p>In Solr 4.3 the described API was improved and is now being prepared to enable not only reading of the index structure, but also writing modifications to it with the use of HTTP requests. We can expect that feature in one of the upcoming versions of Apache Solr, so its worth waiting in my opinion, at least by those who needs it.</p>
<p>W Solr 4.3 opisywane API zostało usprawnione oraz jest przygotowywane do umożliwienia zmian w strukturze indeksu za pomocą protokołu HTTP. Możemy zatem spodziewać się, iż w jednej z kolejnych wersji serwera wyszukiwania Solr otrzymamy możliwość łatwej zmiany struktury indeksu, przynajmniej takich, które nie będą powodować konfliktów z już zaindeksowanymi danymi.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2013/05/20/solr-4-2-index-structure-reading-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>&#8220;Car sale application&#8221; – Spatial Search, adding location data (part 3)</title>
		<link>https://solr.pl/en/2011/03/14/car-sale-application-spatial-search-adding-location-data-part-3/</link>
					<comments>https://solr.pl/en/2011/03/14/car-sale-application-spatial-search-adding-location-data-part-3/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 14 Mar 2011 08:19:01 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[schema]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=221</guid>

					<description><![CDATA[The amount of announcements in our database is so large, that our web site users started to look for another option to filter search results and another way of sorting them. We need to add the functionality, which allows us]]></description>
										<content:encoded><![CDATA[<p>The amount of announcements in our database is so large, that our web site users   started to look for another option to filter search results and another way of sorting them. We need to add the functionality, which allows us to operate with localization data related to the cars.</p>
<p><span id="more-221"></span></p>
<h2>Requirements specification</h2>
<p lang="pl-PL">We would like to add two new functionalities:</p>
<ol>
<li>Filtering the results in order to display only those announcements, that are located not farther than x kilometres from the given place, where x = 50,100,200,500,1000 km.</li>
<li>Sorting the results using the distance between the given place and the given car&#8217;s localization.</li>
</ol>
<p>In order to face the requirements, we need to use solr&#8217;s functionality called “Spatial Search”, that is available in solr distribution from version 3.1. The changes we need to provide are related to schema.xml file modifications and the input data changes, where we have to add the information about the localization of every car. In the end we will create proper requests.</p>
<h2>Schema.xml changes</h2>
<ol>
<li>New field types definitions:
<ul>
<li>the first definition is nothing more than another numerical type:</li>
<pre class="brush:xml">&lt;fieldType name="tdouble" precisionStep="8" omitNorms="true" positionIncrementGap="0"/&gt;</pre>
<li>the second definition uses the &#8220;solr.LatLonType&#8221; class, which allows us to index localization data using the dynamic field with suffix &#8220;_coordinate&#8221;:</li>
<pre class="brush:xml">&lt;fieldType name="location" subFieldSuffix="_coordinate"/&gt;</pre>
</ul>
</li>
<li>New fields definitions:
<ul>
<li>field, that will be used to accumulate the city name data, that is related to every car:</li>
<pre class="brush:xml">&lt;field name="city" type="string" indexed="true" stored="true" /&gt;</pre>
<li>&#8220;loc&#8221; field will be used to index localization data:</li>
<pre class="brush:xml">&lt;field name="loc" type="location" indexed="true" stored="false"/&gt;</pre>
<li>the dynamic field used internally to accumulate the information provided by the &#8220;loc&#8221; field:</li>
<pre class="brush:xml">&lt;dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/&gt;</pre>
</ul>
</li>
</ol>
<h2>Input data analysis</h2>
<p>In order to present how to modify the input data, let&#8217;s take 5 announcements from the cities:</p>
<ol>
<li>Koszalin
<ul>
<li><em>latitude</em>: 54.12</li>
<li><em>longitude</em>: 16.11</li>
</ul>
</li>
<li>Białystok
<ul>
<li><em>latitude</em>: 53.08</li>
<li><em>longitude</em>: 23.09</li>
</ul>
</li>
<li>Szczecin
<ul>
<li><em>latitude</em>: 53.25</li>
<li><em>longitude</em>: 14.35</li>
</ul>
</li>
<li>Gdańsk
<ul>
<li><em>latitude</em>: 54.21</li>
<li><em>longitude</em>: 18.40</li>
</ul>
</li>
<li>Warszawa
<ul>
<li><em>latitude</em>: 52.15</li>
<li><em>longitude</em>: 21.00</li>
</ul>
</li>
</ol>
<p>We provide the localization data by entering the latitude and longitude separated by the comma in the &#8220;loc&#8221; field. Our data might look like this:
</p>
<pre class="brush:xml">&lt;add&gt;
   &lt;doc&gt;
      &lt;field name="id"&gt;1&lt;/field&gt;
      &lt;field name="make"&gt;Audi&lt;/field&gt;
      &lt;field name="model"&gt;80&lt;/field&gt;
      &lt;field name="year"&gt;2008&lt;/field&gt;
      &lt;field name="price"&gt;9774&lt;/field&gt;
      &lt;field name="engine_size"&gt;2000&lt;/field&gt;
      &lt;field name="mileage"&gt;92467&lt;/field&gt;
      &lt;field name="colour"&gt;green&lt;/field&gt;
      &lt;field name="damaged"&gt;false&lt;/field&gt;
      &lt;field name="city"&gt;Koszalin&lt;/field&gt;
      &lt;field name="loc"&gt;54.12,16.11&lt;/field&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;field name="id"&gt;2&lt;/field&gt;
      &lt;field name="make"&gt;Audi&lt;/field&gt;
      &lt;field name="model"&gt;A8&lt;/field&gt;
      &lt;field name="year"&gt;2009&lt;/field&gt;
      &lt;field name="price"&gt;9078&lt;/field&gt;
      &lt;field name="engine_size"&gt;1000&lt;/field&gt;
      &lt;field name="mileage"&gt;31369&lt;/field&gt;
      &lt;field name="colour"&gt;black&lt;/field&gt;
      &lt;field name="damaged"&gt;false&lt;/field&gt;
      &lt;field name="city"&gt;Białystok&lt;/field&gt;
      &lt;field name="loc"&gt;53.08,23.09&lt;/field&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;field name="id"&gt;3&lt;/field&gt;
      &lt;field name="make"&gt;Audi&lt;/field&gt;
      &lt;field name="model"&gt;TT&lt;/field&gt;
      &lt;field name="year"&gt;1997&lt;/field&gt;
      &lt;field name="price"&gt;1109&lt;/field&gt;
      &lt;field name="engine_size"&gt;1299&lt;/field&gt;
      &lt;field name="mileage"&gt;116987&lt;/field&gt;
      &lt;field name="colour"&gt;silver&lt;/field&gt;
      &lt;field name="damaged"&gt;true&lt;/field&gt;
      &lt;field name="city"&gt;Szczecin&lt;/field&gt;
      &lt;field name="loc"&gt;53.25,14.35&lt;/field&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;field name="id"&gt;4&lt;/field&gt;
      &lt;field name="make"&gt;BMW&lt;/field&gt;
      &lt;field name="model"&gt;Seria 7&lt;/field&gt;
      &lt;field name="year"&gt;2007&lt;/field&gt;
      &lt;field name="price"&gt;140000&lt;/field&gt;
      &lt;field name="engine_size"&gt;3000&lt;/field&gt;
      &lt;field name="mileage"&gt;418000&lt;/field&gt;
      &lt;field name="colour"&gt;green&lt;/field&gt;
      &lt;field name="damaged"&gt;false&lt;/field&gt;
      &lt;field name="city"&gt;Gdańsk&lt;/field&gt;
      &lt;field name="loc"&gt;54.21,18.40&lt;/field&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;field name="id"&gt;5&lt;/field&gt;
      &lt;field name="make"&gt;Chevrolet&lt;/field&gt;
      &lt;field name="model"&gt;TrailBlazer&lt;/field&gt;
      &lt;field name="year"&gt;2007&lt;/field&gt;
      &lt;field name="price"&gt;140000&lt;/field&gt;
      &lt;field name="engine_size"&gt;3000&lt;/field&gt;
      &lt;field name="mileage"&gt;418000&lt;/field&gt;
      &lt;field name="colour"&gt;green&lt;/field&gt;
      &lt;field name="damaged"&gt;false&lt;/field&gt;
      &lt;field name="city"&gt;Warszawa&lt;/field&gt;
      &lt;field name="loc"&gt;52.15,21.00&lt;/field&gt;
   &lt;/doc&gt;
&lt;/add&gt;</pre>
<h2>Let&#8217;s create queries</h2>
<p>We have our localization data in the index, so all we need right now is to create queries that will satisfy our needs. Let&#8217;s imagine, that we are searching for announcements when being in Białystok city, which is located about 200 km away from the Warszawa city, about  400 km away from the Gdańsk city, about  550 km away from the Koszalin city and about 650 km away from the Szczecin city.</p>
<p>To execute the first point from the requirements specification, we add the special filter query to our request:
</p>
<pre class="brush:xml">...&amp;fq={!geofilt sfield=loc}&amp;pt=53.08,23.09&amp;d=50</pre>
<p>where:</p>
<ul>
<li><em>sfield</em> &#8211; the name of the field, where we have our localization data indexed.</li>
<li><em>pt</em> &#8211; the localization of the starting point, it is the Białystok city in our case.</li>
<li><em>d</em> &#8211; the distance used to narrow the search results. By using the 50,100,200,500,1000 values we can satisfy all our needs.</li>
</ul>
<p>Example:</p>
<ol>
<li>Query:
<pre class="brush:xml">q=*:*&amp;fq={!geofilt sfield=loc}&amp;pt=53.08,23.09&amp;d=200</pre>
</li>
<li>Search results:</li>
<pre class="brush:xml">&lt;result name="response" numFound="2" start="0"&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Białystok&lt;/str&gt;
      &lt;str name="colour"&gt;black&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;1000&lt;/int&gt;
      &lt;str name="id"&gt;2&lt;/str&gt;
      &lt;str name="make"&gt;Audi&lt;/str&gt;
      &lt;int name="mileage"&gt;31369&lt;/int&gt;
      &lt;str name="model"&gt;A8&lt;/str&gt;
      &lt;float name="price"&gt;9078.0&lt;/float&gt;
      &lt;int name="year"&gt;2009&lt;/int&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Warszawa&lt;/str&gt;
      &lt;str name="colour"&gt;green&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;3000&lt;/int&gt;
      &lt;str name="id"&gt;5&lt;/str&gt;
      &lt;str name="make"&gt;Chevrolet &lt;/str&gt;
      &lt;int name="mileage"&gt;418000&lt;/int&gt;
      &lt;str name="model"&gt;TrailBlazer&lt;/str&gt;
      &lt;float name="price"&gt;140000.0&lt;/float&gt;
      &lt;int name="year"&gt;2007&lt;/int&gt;
   &lt;/doc&gt;
&lt;/result&gt;</pre>
</ol>
<p>That&#8217;s great, we don&#8217;t have any announcements from the Koszalin, Gdańsk or Szczecin city, as these cities are located farther than 200 km from the Białystok city.</p>
<p>To execute the second point from the requirements specification, we use the possibility to sort the search results by using the geodist function. The query would look like this:
</p>
<pre class="brush:xml">...&amp;sfield=loc&amp;pt=53.08,23.09&amp;sort=geodist()+desc</pre>
<p>The example of sorting the search results using the distance, starting from the Białystok city:</p>
<ol>
<li>Query:
<pre class="brush:xml">q=*:*&amp;sfield=loc&amp;pt=53.08,23.09&amp;sort=geodist()+asc</pre>
</li>
<li>Search results:</li>
<pre class="brush:xml">&lt;result name="response" numFound="5" start="0"&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Bialystok&lt;/str&gt;
      &lt;str name="colour"&gt;black&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;1000&lt;/int&gt;
      &lt;str name="id"&gt;2&lt;/str&gt;
      &lt;str name="make"&gt;Audi&lt;/str&gt;
      &lt;int name="mileage"&gt;31369&lt;/int&gt;
      &lt;str name="model"&gt;A8&lt;/str&gt;
      &lt;float name="price"&gt;9078.0&lt;/float&gt;
      &lt;int name="year"&gt;2009&lt;/int&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Warszawa&lt;/str&gt;
      &lt;str name="colour"&gt;green&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;3000&lt;/int&gt;
      &lt;str name="id"&gt;5&lt;/str&gt;
      &lt;str name="make"&gt;Chevrolet &lt;/str&gt;
      &lt;int name="mileage"&gt;418000&lt;/int&gt;
      &lt;str name="model"&gt;TrailBlazer&lt;/str&gt;
      &lt;float name="price"&gt;140000.0&lt;/float&gt;
      &lt;int name="year"&gt;2007&lt;/int&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Gdańsk&lt;/str&gt;
      &lt;str name="colour"&gt;green&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;3000&lt;/int&gt;
      &lt;str name="id"&gt;4&lt;/str&gt;
      &lt;str name="make"&gt;BMW&lt;/str&gt;
      &lt;int name="mileage"&gt;418000&lt;/int&gt;
      &lt;str name="model"&gt;Seria 7&lt;/str&gt;
      &lt;float name="price"&gt;140000.0&lt;/float&gt;
      &lt;int name="year"&gt;2007&lt;/int&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Koszalin&lt;/str&gt;
      &lt;str name="colour"&gt;green&lt;/str&gt;
      &lt;bool name="damaged"&gt;false&lt;/bool&gt;
      &lt;int name="engine_size"&gt;2000&lt;/int&gt;
      &lt;str name="id"&gt;1&lt;/str&gt;
      &lt;str name="make"&gt;Audi&lt;/str&gt;
      &lt;int name="mileage"&gt;92467&lt;/int&gt;
      &lt;str name="model"&gt;80&lt;/str&gt;
      &lt;float name="price"&gt;9774.0&lt;/float&gt;
      &lt;int name="year"&gt;2008&lt;/int&gt;
   &lt;/doc&gt;
   &lt;doc&gt;
      &lt;str name="city"&gt;Szczecin&lt;/str&gt;
      &lt;str name="colour"&gt;silver&lt;/str&gt;
      &lt;bool name="damaged"&gt;true&lt;/bool&gt;
      &lt;int name="engine_size"&gt;1299&lt;/int&gt;
      &lt;str name="id"&gt;3&lt;/str&gt;
      &lt;str name="make"&gt;Audi&lt;/str&gt;
      &lt;int name="mileage"&gt;116987&lt;/int&gt;
      &lt;str name="model"&gt;TT&lt;/str&gt;
      &lt;float name="price"&gt;1109.0&lt;/float&gt;
      &lt;int name="year"&gt;1997&lt;/int&gt;
   &lt;/doc&gt;
&lt;/result&gt;</pre>
</ol>
<p>That&#8217;s correct! Mission accomplished.</p>
<h2>The end</h2>
<p>Once more we are up to our website users expectations. This time we have added the functionalities, which allow our users to filter and sort the search results using the localization and distance data. Full success!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2011/03/14/car-sale-application-spatial-search-adding-location-data-part-3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>5 sins of schema.xml modifications</title>
		<link>https://solr.pl/en/2010/08/30/5-sins-of-schema-xml-modifications/</link>
					<comments>https://solr.pl/en/2010/08/30/5-sins-of-schema-xml-modifications/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 30 Aug 2010 12:08:35 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[attributes]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[index structure]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[mistake]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[schema.xml]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[structure]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=71</guid>

					<description><![CDATA[I made a promise and here it is &#8211; the entry on the most common mistakes when designing Solr index, which is when You create or modify the schema.xml file for Your system implementation. Feel free to read on 😉]]></description>
										<content:encoded><![CDATA[<p>I made a promise and here it is &#8211; the entry on the most common mistakes when designing Solr index, which is when You create or modify the <em>schema.xml</em> file for Your system implementation. Feel free to read on <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p><span id="more-71"></span></p>
<p>Each of us knows what is schema.xml file and what is (if not, I invite you to read the entry located at: <a href="http://solr.pl/2010/08/16/what-is-schema-xml/?lang=en" target="_blank" rel="noopener noreferrer">http://solr.pl/2010/08/16/what-is-schema-xml/?lang=en</a>). What are the most frequently commit errors creating or updating this file? I personally met with the following:</p>
<h3>1. Trash in the configuration</h3>
<p>I confess that the first principle is to keep the file <em>schema.xml</em> in the simplest possible form. Linked to this is a very important issue &#8211; this file should not be synonymous with chaos. In other word, do not stick with unnecessary comments, unwanted types, fields and so on. Order in the structure of the <em>schema.xml</em> file not only helps us to maintain this file and its modifications with ease, but also assures us that no information that is unnecessary will be stored in Solr index.</p>
<h3>2. Cosmetic changes to the default configuration</h3>
<p>How many of those who use Solr in their daily work took the default<em> schema.xml</em> file supplied in the example implementation Solr and only slightly modified the contents &#8211; for example, changing only the names of the fields ? I should raise my hand too, because I did it once. This is a pretty big mistake. Someone may ask why. Are you sure You need English stemming when implementing search for content written in Polish ? I think not. The same applies to field and type attributes like term vectors.</p>
<h3>3. No updates</h3>
<p>Sometimes I find the implementation of search based application, where update of Solr does not mean an update of <em>schema.xml</em> file. If it is a conscious decision, dictated by such costly or even impossible re-indexing of all data, I understand the situation. But there are cases where an upgrade would bring only benefits, and where costs of such upgrade would be minimal (eg less expensive re-index or slight changes in the application). Do not be afraid to update the <em>schema.xml</em> file &#8211; whether it is to update the fields, update types, whether the addition of newer stuff. A good example is the migration from Solr 1.3 to version 1.4 &#8211; newer version introduced significant changes associated with numeric types, where migration to the new types would result in great increase in query performance using those types (such as queries using value ranges).</p>
<h3>4. &#8220;I`ll use it one day&#8221;</h3>
<p>Adding new types, not removing unnecessary now, the same in the case of fields, or <em>copyField </em>definition. Most of us think &#8211; that old definition can be useful in the future, but remember that each type is some extra portion of memory needed by Solr, each field is a place in the index. My small advice &#8211; if you stop to use the type, field, or whatever else you have in your configuration file (not only in the <em>schema.xml</em>), simply remove it from this file. Applying this principle throughout the life cycle of the applications using Solr will ensure You that the index is in optimal condition, and after a few months since another feature implementation You will not need to be puzzled and as a result You will not need to dig into the application code to determine if the field is used in some forgotten code fragment.</p>
<h3>5. Attributes, attributes and again attributes</h3>
<p>Preservation of original values, adding term vectors and its properties are just examples of things we don`t need in every implementation. Sometimes we have more than required by the application index. A larger index, lower productivity, at least in some cases (eg, indexing). It is worth considering if you really need all this information, which we say to Solr to calculate and store. Removing some unnecessary, of course, from our point of view of information, may surprise us. Sometimes it is worth a try;)</p>
<p>Feel free to comment, because I will read eagerly, for what else we should pay attention to when modifying schema.xml file.</p>
<p>Finally, I think that it is worth to mention the article <em>&#8220;The Seven Deadly Sins of Solr&#8221;</em> LucidImagination published on the website at: <a href="http://www.lucidimagination.com/blog/2010/01/21/the-seven-deadly-sins-of-solr" target="_blank" rel="noopener noreferrer">http://www.lucidimagination.com/blog/2010/01/21/the-seven-deadly-sins-of-solr</a>. It describes bad practices when working with Solr. In my opinion, interesting reading. I highly recommend it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2010/08/30/5-sins-of-schema-xml-modifications/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is schema.xml?</title>
		<link>https://solr.pl/en/2010/08/16/what-is-schema-xml/</link>
					<comments>https://solr.pl/en/2010/08/16/what-is-schema-xml/#respond</comments>
		
		<dc:creator><![CDATA[Rafał Kuć]]></dc:creator>
		<pubDate>Mon, 16 Aug 2010 12:05:34 +0000</pubDate>
				<category><![CDATA[Solr]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[schema]]></category>
		<category><![CDATA[schema.xml]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[token]]></category>
		<category><![CDATA[tokenizer]]></category>
		<category><![CDATA[type]]></category>
		<guid isPermaLink="false">http://sematext.solr.pl/?p=64</guid>

					<description><![CDATA[One of the configuration files that describe each implementation Solr is schema.xml file. It describes one of the most important things of the implementation &#8211; the structure of the data index. The information contained in this file allow you to]]></description>
										<content:encoded><![CDATA[<p>One of the configuration files that describe each implementation Solr is <em>schema.xml</em> file. It describes one of the most important things of the implementation &#8211; the structure of the data index. The information contained in this file allow you to control how Solr behaves when indexing the data, or when making queries. <em>Schema.xml</em> is not only the very structure of the index, is also detailed information about data types that have a large influence on the behavior Solr, and usually are treated with neglect. This entry will try to bring some insight about <em>schema.xml</em>.</p>
<p><span id="more-64"></span></p>
<p><em>Schema.xml</em> file consists of several parts:</p>
<ul>
<li>version,</li>
<li>type definitions,</li>
<li>field definitions,</li>
<li>copyField section,</li>
<li>additional definitions.</li>
</ul>
<h3>Version</h3>
<p>The first thing we come across in the <em>schema.xml</em> file is the version. This is the information for Solr how to treat some of the attributes in <em>schema.xml</em> file. The definition is as follows:
</p>
<pre class="brush:xml">&lt;schema name="example" version="1.3"&gt;</pre>
<p>Please note that this is not the definition of the version from the perspective of your project. At this point Solr supports four versions of a <em>schema.xml</em> file:</p>
<ul>
<li>1.0 &#8211; <em>multiValued </em>attribute does not exist, all fields are multivalued by default.</li>
<li>1.1 &#8211; introduced <em>multiValued </em>attribute, the default attribute value is <em>false</em>.</li>
<li>1.2 &#8211; introduced <em>omitTermFreqAndPositions </em>attribute, the default value is <em>true</em> for all fields, besides text fields.</li>
<li>1.3 &#8211; removed the possibility of an optional compression of fields.</li>
</ul>
<h3>Type definitions</h3>
<p>Type definitions can be logically divided into two separate sections &#8211; the simple types and complex types. Simple types as opposed to the complex types do not have a defined filters and tokenizer.</p>
<p><strong>Simple types</strong></p>
<p>First thing we see in the <em>schema.xml</em> file after version are types definition. Each type is described as a number of attributes defining the behavior of that type. First, some attributes that describe each type and are mandatory:</p>
<ul>
<li><em>name </em>&#8211; name of the type (required attribute).</li>
<li><em>class </em>&#8211; class that is responsible for the implementation. Please note  that classes are delivered from standard Solr packaged will have names  with &#8216;solr&#8217; prefix.</li>
</ul>
<p>Besides the two mentioned above, types can have the following optional attributes:</p>
<ul>
<li> <em>sortMissingLast </em>&#8211; attribute specifying how values in a field based on this type should be treated in case of sorting. When set to <em>true</em> documents without value in a field of this type will always be at the end of the results list regardless of sort order. The default attribute value is <em>false</em>. Attribute can be used only for types that are considered by Lucene as a string.</li>
<li><em>sortMissingFirst </em>&#8211; attribute specifying how values in a field based on  this type should be treated in case of sorting. When set to <em>true</em> documents without value in a field of this type will always be at the  first positions of the results list regardles of sort order. The default  attribute value is <em>false</em>. Attribute can be used only for types that are considered by Lucene as a string.</li>
<li><em>omitNorms </em>&#8211; attribute specifying whether field normalization should take place.</li>
<li><em>omitTermFreqAndPositions </em>&#8211; attribute specifying whether term frequency and term positions should be calculated.</li>
<li><em>indexed </em>&#8211; attribute specifying whether the field based on this type will keep their original values.</li>
<li><em>positionIncrementGap </em>&#8211; attribute specifying how many position Lucene should skip.</li>
</ul>
<p>It is worth remembering that in the default settings <em>sortMissingLast </em>and <em>sortMissingFirst</em> attributes Lucene will apply behavior of placing a document with blank field values at the beginning of the ascending sort, and at the end of the list of results for descending sorting.</p>
<p>One more options for simple types, but only those based on <em>Trie*Field</em> classes:</p>
<ul>
<li><em>precisionStep</em> &#8211; attribute specifying the number of bits of precision. The greater the number of bits, the faster the queries based on numerical ranges. This however, also increases the size of the index, as more values are indexed. Set attribute value to 0 to disable the functionality of indexing at various precisions.</li>
</ul>
<p>An example of a simple type defined:
</p>
<pre class="brush:xml">&lt;fieldType name="string" class="solr.StrField" sortMissingLast="<em>true</em>" omitNorms="<em>true</em>"/&gt;</pre>
<p><strong>Complex types</strong></p>
<p>In addition to simple types, <em>schema.xml</em> file may include types consisting of a tokenizer and filters. Tokenizer is responsible for dividing the contents of the field in the tokens, while the filters are responsible for further token analysis. For example, the type that is responsible for dealing with the texts in Polish, would consist of a tokenizer in charge of the division of words based on whitespace, commas and periods. Filters for that type could be responsible for bringing generated tokens to lowercase, further division of tokens (for example on the basis of dashes), and then bringing tokens to the basic form.</p>
<p>Complex types, like simple types, have their name (<em>name </em>attribute) and the class which is responsible for implementation (<em>class </em>attribute). They can also be characterized by other attributes as described in the case of simple types (on the same basis). In addition, however, complex types can have a definition of tokenizer and filters to be used at the stage of indexing, and at the stage of query. As most of you know, for a given phase (indexing, or query) there can can be many filters defined but only one tokenizer. For example, just looks like a text type definition look like in the example provided with Solr:
</p>
<pre class="brush:xml">&lt;fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="<em>true</em>"&gt;
   &lt;analyzer type="index"&gt;
      &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="<em>true</em>" words="stopwords.txt" enablePositionIncrements="<em>true</em>" /&gt;
      &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
      &lt;filter class="solr.PorterStemFilterFactory"/&gt;
   &lt;/analyzer&gt;
   &lt;analyzer type="query"&gt;
      &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
      &lt;filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="<em>true</em>" expand="<em>true</em>"/&gt;
      &lt;filter class="solr.StopFilterFactory" ignoreCase="<em>true</em>" words="stopwords.txt" enablePositionIncrements="<em>true</em>" /&gt;
      &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/&gt;
      &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
      &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
      &lt;filter class="solr.PorterStemFilterFactory"/&gt;
   &lt;/analyzer&gt;
&lt;/fieldType&gt;</pre>
<p>It is worth noting that there is an additional attribute for the text field type:</p>
<ul>
<li> <em>autoGeneratePhraseQueries</em></li>
</ul>
<p>This attribute is responsible for telling filters how to behave when dividing tokens. Some filters (such as <em>WordDelimiterFilter</em>) can divide tokens into a set of tokens. Setting the attribute to <em>true</em> (default value) will automatically generate phrase queries. This means that <em>WordDelimiterFilter </em>will divide the word &#8220;wi-fi&#8221; into two tokens &#8220;wi&#8221; and &#8220;fi&#8221;. With autoGeneratePhraseQueries set to <em>true</em> query sent to Lucene will look like <code>"field:wi fi"</code>, while with set to <em>false</em> Lucene query will look like <code>field:wi OR field:fi</code>. However, please note, that this attribute only behaves well with tokenizers based on white spaces.</p>
<p>Returning to the type definition. As you can see, I gave an example which has two main sections:
</p>
<pre class="brush:xml">&lt;analyzer type="index"&gt;</pre>
<p>and
</p>
<pre class="brush:xml">&lt;analyzer type="query"&gt;</pre>
<p>The first section is responsible for the definition of the type, which will be used for indexing documents, the second section is responsible for the definition of type used for queries to fields based on this type. Note that if you want to use the same definitions for indexing and query phase, you can opt out of the two sections. Then our definition will look like this:
</p>
<pre class="brush:xml">&lt;fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="<em>true</em>"&gt;
   &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt;
   &lt;filter class="solr.StopFilterFactory" ignoreCase="<em>true</em>" words="stopwords.txt" enablePositionIncrements="<em>true</em>" /&gt;
   &lt;filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/&gt;
   &lt;filter class="solr.LowerCaseFilterFactory"/&gt;
   &lt;filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/&gt;
   &lt;filter class="solr.PorterStemFilterFactory"/&gt;
&lt;/fieldType&gt;</pre>
<p>As I mentioned in the definition of each complex type there is a tokenizer and a series of filters (though not necessarily). I will not describe each filter and tokenizer available in Solr. This information is available at the following address: <a href="http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters" target="_blank" rel="noopener noreferrer">http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters</a>.</p>
<p>At the end I wanted to add an important thing. Starting from 1.4 Solr tokenizer does not need to be the first mechanism that deals with the analysis of the field. Solr 1.4 introduced new filters &#8211; <em>CharFilters </em>that operate on the field before tokenizer and transmit the result to the tokenizer. It is worth to know because it might come in useful.</p>
<p><strong>Multi-dimensional types</strong></p>
<p>At the end I left myself a little addition &#8211; a novelty in Solr 1.4 &#8211; multi-dimensional fields &#8211;  fields consisting of a number of other fields. Generally speaking, the assumption of this type of field was simple &#8211; to store in Solr pairs of values, triples or more related data, such as georaphical point coordinates. In practice this is realized by means of dynamic fields, but let me not get into the implementation details. The sample type definition that will consist two fields:
</p>
<pre class="brush:xml">&lt;fieldType name="location" class="solr.PointType" dimension="2" subFieldSuffix="_d"/&gt;</pre>
<p>In addition to standard attributes: name and class there are two others:</p>
<ul>
<li> dimension &#8211; the number of dimensions (used by the class attribute <em>solr.PointType</em>).</li>
<li>subFieldSuffix &#8211; suffix, which will be added to the dynamic fields  created by that type. It is important to remember that the field based  on the presented type will create three fields in the index &#8211; the actual  field (for example named mylocation and two additional dynamic fields).</li>
</ul>
<h3><strong>Field Definitions</strong></h3>
<p>Definitions of the fields is another section in the <em>schema.xml</em> file, the section, which in theory should be of interest to us the most during the design of Solr index. As a rule, we find here two kinds of field definitions:</p>
<ol>
<li>Static Fields</li>
<li>Dynamic Fields</li>
</ol>
<p>These fields are treated differently by the Solr. The first type of fields, are fields that are available under one name. Dynamic fields are fields that are available under many names &#8211; actually their name are a simple regular expression (name starting or ending with a &#8216;*&#8217; sign). Please note that Solr first selects the static field, then the dynamic field. In addition, if the field name matches more than one definition, Solr will select a field with a longer name pattern.</p>
<p>Returning to the definition of the fields (both static and dynamic), they consist of the following attributes:</p>
<ul>
<li><em>name </em>&#8211; the name of the field (required attribute).</li>
<li><em>type </em>&#8211; type of field, which is one of the pre-defined types (required attribute).</li>
<li><em>indexed </em>&#8211; if a field is to be indexed (set to <em>true</em>, if you want to search or sort on this field).</li>
<li><em>stored </em>&#8211; whether you want to store the original values (set to <em>true</em>, if we want to retrieve the original value of the field).</li>
<li><em>omitNorms </em>&#8211; whether you want norms to be ignored (set to <em>true</em> for the fields for which You will apply the full-text search).</li>
<li><em>termVectors </em>&#8211; set to <em>true</em> in the case when we want to keep so called term vectors. The default parameter value is <em>false</em>. Some features require setting this parameter to <em>true</em> (eg <em>MoreLikeThis </em>or <em>FastVectorHighlighting</em>).</li>
<li><em>termPositions </em>&#8211; set to <em>true</em>, if You want to keep term positions with the term vector. Setting to <em>true</em> will cause the index to expand its size.</li>
<li><em>termOffsets </em>&#8211; set to <em>true</em>, if You want to keep term offsets together with term vector. Setting to <em>true</em> will cause the index to expand its size.</li>
<li><em>default </em>&#8211; the default value to be given to the field when the document was not given any value in this field.</li>
</ul>
<p>The following examples of definitions of fields:
</p>
<pre class="brush:xml">&lt;field name="id" type="string" indexed="<em>true</em>" stored="<em>true</em>" required="<em>true</em>" /&gt;
&lt;field name="includes" type="text" indexed="<em>true</em>" stored="<em>true</em>" termVectors="<em>true</em>" termPositions="<em>true</em>" termOffsets="<em>true</em>" /&gt;
&lt;field name="timestamp" type="date" indexed="<em>true</em>" stored="<em>true</em>" default="NOW" multiValued="<em>false</em>"/&gt;
&lt;dynamicField name="*_i" type="int" indexed="<em>true</em>" stored="<em>true</em>"/&gt;</pre>
<p>And finally, additional information to remember. In addition to the attributes listed above in the fields definition, we can overwrite the attributes that have been defined for type (eg whether a field is to be multiValued &#8211; the above example for a field called timestamp). Sometimes, this functionality can be useful if you need a specific field whose type is slightly different from other types (as in the example &#8211; only multiValued attribute). Of course, keep in mind the limitations imposed on the individual attributes associated with types.</p>
<h3>CopyField section</h3>
<p>In short, this section is responsible for copying the contents of fields to other fields. We define the field which value should be copied, and the destination field. Please note that copying takes place before the field value is analyzed. Example copyField definition:
</p>
<pre class="brush:xml">&lt;copyField source="category" dest="text"/&gt;</pre>
<p>For the sake of accuracy, occurring attributes mean:</p>
<ul>
<li>source &#8211; the source field,</li>
<li>dest &#8211; the destination field.</li>
</ul>
<h3>Additional definitions</h3>
<p><strong>1. Unique key definition</strong></p>
<p>The definition of a unique key that makes possible to unambiguously identify the document. Defining a unique key is not necessary, but is recommended. Sample definition:
</p>
<pre class="brush:xml">&lt;uniqueKey&gt;id&lt;/uniqueKey&gt;</pre>
<p><strong>2. Default search field definition</strong></p>
<p>The Section is responsible for defining a default search field, which Solr use in case You have not given any field. Sample definition:
</p>
<pre class="brush:xml">&lt;defaultSearchField&gt;content&lt;/defaultSearchField&gt;</pre>
<p><strong>3. Default logical operator definition</strong></p>
<p>This section is responsible for the definition of default logical operator that will be used. Sample definition looks as follows:
</p>
<pre class="brush:xml">&lt;solrQueryParser defaultOperator="OR" /&gt;</pre>
<p>Possible values are: <em>OR </em>and <em>AND</em>.</p>
<p><strong>4. Defining similarity</strong></p>
<p>Finally we define the similarity that we will use. It is rather a topic for another post, but you must know that if necessary You can change the default similarity (currently in Solr trunk there are already two classes of similarity). The sample definition is as follows:
</p>
<pre class="brush:xml">&lt;similarity class="pl.solr.similarity.CustomSimilarity" /&gt;</pre>
<h3>A few words at the end</h3>
<p>Information presented above should give some insight on what <em>schema.xml</em> file is and what correspond to the different sections in this file. Soon I will try to write what You should avoid when designing the index.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://solr.pl/en/2010/08/16/what-is-schema-xml/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
