我在SOLR中遇到拼写检查问题。我正在使用Morfologik字典。
首先,当我打开查询网址时:/solr/biurwa/select?q=dlug&indent=true
我得到一些提示:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">5</int>
<lst name="params">
<str name="indent">true</str>
<str name="q">dlug</str>
</lst>
</lst>
<result name="response" numFound="0" start="0">
</result>
<lst name="spellcheck">
<lst name="suggestions">
<lst name="dlug">
<int name="numFound">3</int>
<int name="startOffset">0</int>
<int name="endOffset">4</int>
<arr name="suggestion">
<str>dług</str>
<str>długi</str>
<str>druk</str>
</arr>
</lst>
<lst name="collation">
<str name="collationQuery">dług</str>
<int name="hits">11</int>
<lst name="misspellingsAndCorrections">
<str name="dlug">dług</str>
</lst>
</lst>
<lst name="collation">
<str name="collationQuery">długi</str>
<int name="hits">14</int>
<lst name="misspellingsAndCorrections">
<str name="dlug">długi</str>
</lst>
</lst>
<lst name="collation">
<str name="collationQuery">druk</str>
<int name="hits">2</int>
<lst name="misspellingsAndCorrections">
<str name="dlug">druk</str>
</lst>
</lst>
</lst>
</lst>
</response>
但是当我使用拼写网址时:
solr/spell?q=dlug&spellcheck=true&spellcheck.collate=true&wt=json&indent=true
我得到零提示:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<result name="response" numFound="0" start="0">
</result>
<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">false</bool>
</lst>
</lst>
</response>
有人可以告诉我为什么吗?这是我的schema.xml:
<schema name="offer" version="1.0">
<types>
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.MorfologikFilterFactory" dictionary="MORFOLOGIK"/>
</analyzer>
</fieldType>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
<fieldtype name="binary" class="solr.BinaryField"/>
<fieldType name="pint" class="solr.IntField"/>
<fieldType name="plong" class="solr.LongField"/>
<fieldType name="pfloat" class="solr.FloatField"/>
<fieldType name="pdouble" class="solr.DoubleField"/>
<fieldType name="pdate" class="solr.DateField" sortMissingLast="true"/>
<fieldType name="random" class="solr.RandomSortField" indexed="true" />
</types>
<fields>
<field name="id" type="int" indexed="true" stored="true" multiValued="false" required="true" />
<field name="code" type="string" indexed="true" stored="true" multiValued="false" required="true" />
<field name="barcode" type="string" indexed="true" stored="true" multiValued="false" required="false" />
<field name="code_producer" type="string" indexed="true" stored="true" multiValued="false" required="false" />
<field name="sku" type="string" indexed="true" stored="true" multiValued="false" required="false" />
<field name="name" type="string" indexed="true" stored="true" multiValued="true" required="true" />
<field name="description" type="string" indexed="true" stored="true" multiValued="false" required="false" />
<field name="available" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="active" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="price_retail" type="double" indexed="false" stored="true" multiValued="false" required="true" />
<field name="price_retail_old" type="double" indexed="false" stored="true" multiValued="false" required="true" />
<field name="price_wholesale" type="double" indexed="false" stored="true" multiValued="false" required="true" />
<field name="price_wholesale_old" type="double" indexed="false" stored="true" multiValued="false" required="true" />
<field name="price_euro" type="double" indexed="false" stored="true" multiValued="false" required="false" />
<field name="price_VAT" type="double" indexed="false" stored="true" multiValued="false" required="true" />
<field name="status_new" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="status_sale" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="status_promotion" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="status_soon" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="status_proposal" type="int" indexed="false" stored="true" multiValued="false" required="true" />
<field name="id_producer" type="int" indexed="false" stored="true" multiValued="false" required="false" />
<field name="id_file" type="int" indexed="false" stored="true" multiValued="false" required="false" />
<field name="file" type="string" indexed="false" stored="true" multiValued="false" required="false" />
<field name="cat" type="string" indexed="true" stored="true" multiValued="true" required="false" />
<field name="id_category" type="int" indexed="false" stored="true" multiValued="false" required="false" />
<!-- must have -->
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<copyField source="name" dest="text"/>
<copyField source="code" dest="text"/>
<defaultSearchField>name</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
</schema>