Solr returns only one sort for Component Component

I am using solr 3.6, and I would like to use the mappings from Essester as an autocomplete solution for multi-user searches. Unfortunately, Guidester returns only one sort for multi-user searches, even if there are many sentences for each individual term. Depending on my test queries and basic indexed data, I'm sure there should be more mappings.

Is there something wrong with my Guidester configuration?

<!--configuration --> <searchComponent class="solr.SpellCheckComponent" name="suggest"> <lst name="spellchecker"> <str name="name">suggest</str> <str name="classname">org.apache.solr.spelling.suggest.Suggester</str> <str name="lookupImpl">org.apache.solr.spelling.suggest.fst.WFSTLookupFactory</str> <str name="field">text</str> <!-- the indexed field to derive suggestions from --> <!--<float name="threshold">0.0005</float> disabled for test--> <str name="buildOnCommit">true</str> </lst> </searchComponent> <requestHandler class="org.apache.solr.handler.component.SearchHandler" name="/suggest"> <lst name="defaults"> <str name="spellcheck">true</str> <str name="spellcheck.dictionary">suggest</str> <str name="spellcheck.onlyMorePopular">true</str> <str name="spellcheck.count">200</str> <str name="spellcheck.collate">true</str> <str name="spellcheck.maxCollations">10</str> </lst> <arr name="components"> <str>suggest</str> </arr> </requestHandler> 

Example answer for q = bio + ber:

 <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">4</int> </lst> <lst name="spellcheck"> <lst name="suggestions"> <lst name="bio"> <int name="numFound">27</int> <int name="startOffset">0</int> <int name="endOffset">3</int> <arr name="suggestion"> <str>bio</str> <str>bio-estetica</str> <str>bio-kosmetik</str> ... </arr> </lst> <lst name="ber"> <int name="numFound">81</int> <int name="startOffset">4</int> <int name="endOffset">7</int> <arr name="suggestion"> <str>beratung</str> <str>bern</str> ... </arr> </lst> <str name="collation">bio beratung</str> </lst> </lst> </response> 
+6
source share
2 answers

I had the same problem as you, and I managed to solve it. Turns out there are a few things you need to know to ensure that multiple sorts work correctly.

First you must specify the QueryComponent in the components list to “offer” requestHandler in solrconfig.xml . Otherwise, your requestHandler does not know how to request the index, so it cannot figure out how many requests each corrected request has, so you only get one. If you added spellcheck.collateExtendedResults=true to your query, you would see that hits are 0, which indicates that Solr did not bother to check the corrected query for the index.

They hint at this with a slightly opaque error message:

INFO: Could not find an instance of QueryComponent. Disabling collation verification against the index.

The easiest way to add this is to use the default QueryComponent , which is called a "query". So, in the XML that you posted above, you will change the "components" part to:

 <arr name="components"> <str>suggest</str> <str>query</str> </arr> 

Secondly, you need to set spellcheck.maxCollations more than 1 (duh), and less intuitively, you need to set spellcheck.maxCollationTries as some large number (e.g. 1000). If either of them is set by default (both values ​​are 0), then Solr will give you only one sort. In addition, you need to set spellcheck.count more than 1.

Third, you need to modify the query to include the field to which you want to search, and the terms must be surrounded by quotation marks to ensure proper sorting. Therefore, in the case of your request:

q=bio+ber

It really should be:

q=text:"bio+ber"

Obviously, in your case, “text” is the default field, so you don't need it. But in my case, I did not use the default field, so I had to specify it. Otherwise, Solr will count hits against the text field, and all results will have 0 hits, so ranking will be useless.

So, in my case, the query looked like this:

 q=my_field:"brain+c" &spellcheck.count=5 &spellcheck.maxCollations=10 &spellcheck.maxCollationTries=1000 &spellcheck.collateExtendedResults=true 

And my answer looked like this:

 <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">4</int> </lst> <lst name="spellcheck"> <lst name="suggestions"> <lst name="brain"> <int name="numFound">1</int> <int name="startOffset">15</int> <int name="endOffset">20</int> <arr name="suggestion"> <str>brain</str> </arr> </lst> <lst name="c"> <int name="numFound">4</int> <int name="startOffset">21</int> <int name="endOffset">23</int> <arr name="suggestion"> <str>cancer</str> <str>cambrian</str> <str>contusion</str> <str>cells</str> </arr> </lst> <lst name="collation"> <str name="collationQuery">my_field:"brain cancer"</str> <int name="hits">2</int> <lst name="misspellingsAndCorrections"> <str name="brain">brain</str> <str name="c">cancer</str> </lst> </lst> <lst name="collation"> <str name="collationQuery">my_field:"brain contusion"</str> <int name="hits">1</int> <lst name="misspellingsAndCorrections"> <str name="brain">brain</str> <str name="c">contusion</str> </lst> </lst> <lst name="collation"> <str name="collationQuery">my_field:"brain cells"</str> <int name="hits">1</int> <lst name="misspellingsAndCorrections"> <str name="brain">brain</str> <str name="c">cells</str> </lst> </lst> </lst> </lst> <result name="response" numFound="0" start="0"/> </response> 

Success!

+14
source

Had the same problem.

This is a Solr 3.6.1 error (not sure about previous versions). Check out: https://issues.apache.org/jira/browse/SOLR-2853 .

Actually this comment is put by light: https://issues.apache.org/jira/browse/SOLR-2853?focusedCommentId=13136014&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13136014

A possible workaround is to set spellcheck.maxCollationTries to the number of collisions you need, but it will also force Solr to check these mappings by search index. Therefore, be careful to set this property to a large number. More on this setting: http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxCollationTries .

The error is not closed, but there are already patches.

I also checked the Solr 4.0.0-BETA code - a fix already exists.

Good luck Solrs!)

0
source

Source: https://habr.com/ru/post/915476/


All Articles