I am pretty new to Solr and getting error on setting up my first example core. I am trying to add new core under admin dashboard but I am receving error about version field.
Is there any workaround for this?
Background:
Schema Xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
For fts-solr:
This is the Solr schema file, place it into solr/conf/schema.xml. You may
want to modify the tokenizers and filters.
-->
<schema name="dovecot" version="1.1">
<types>
<!-- IMAP has 32bit unsigned ints but java ints are signed, so use longs -->
<fieldType name="string" class="solr.StrField" omitNorms="true"/>
<fieldType name="boolean" class="solr.BoolField" omitNorms="true"/>
<fieldType name="long" class="solr.LongField" omitNorms="true"/>
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
</fieldType>
</types>
<fields>
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="box" type="string" indexed="true" stored="true" required="true" />
<field name="user" type="string" indexed="true" stored="true" required="true" />
<field name="ns" type="string" indexed="true" stored="true" required="false" />
<field name="last_uid" type="boolean" indexed="true" stored="false" />
<field name="hdr" type="text" indexed="true" stored="false" />
<field name="body" type="text" indexed="true" stored="false" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>body</defaultSearchField>
<solrQueryParser defaultOperator="AND" />
</schema>
Screen Shot:
Your schema comes from an example for a very old version of Solr. You need to either use the version of Solr that is recommended with that version of Dovecot or adjust it to the new requirements.
Compare your schema to the basic example schema that comes with Solr 6 itself. There is quite a number of differences:
Your field name should also be _version_ (with underscores). The advice you got about removing those is due to StackOverflow formatting (converting underscores to italic)...
Are you getting an error after the restart? Or nothing at all. With new Solr, the cores need to be under the solr home (yours seems to be) and needs to contain core.properties file. If you got an error during the creation, that file may not have been created and restarting the server may not notice the collection/core anyway. Just make sure you are repeating the same steps (e.g. creating/registering core) every time as you are testing your changes.
I would like to add a solution that helped me here; Solr makes a copy of your config file and puts it in [core name]/conf/
folder called managed-schema
. Make sure to remove this file after editing your schema file, or else your changes will not be detected, because Solr seem to use the copy rather than the original schema.xml
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With