Solr query results using *

I want to provide a partial match, so I bind * to the end of the search queries. I noticed that the gatorade search query will return 12 results, while gatorade * returns 7. So it seems like 1 or many, not 0 or many ... how can I achieve this? Am I going to make a partial match in Solr all wrong? Thank.

+3
source share
6 answers

Firstly, I think Solr masks are best summed as "0 or many" than "1 or many." I doubt the source of your problem. (For example, see javadocs for WildcardQuery .)

Secondly, you use stems because I assume that you are dealing with a problem. Solr wildcards can behave somehow strangely with streaming. This is due to the fact that the expansion of wildcards is based on a search in a list of terms stored in an inverted index; these terms will be in the form (possibly something like "gatorad"), not words from the source code (possibly "gatorade" or "gatorades").

, , , "gatorade" "gatorades" "gatorad" . , "gatorade" "gatorades", "gatorad" . gatorade *, Solr , , "gatorade". , . , gatorades *, Solr , "gatorades". , .

-, , :

  • URL- , Solr
  • schema.xml. , A) , , B) ,
+7

, 'gatorade' → 'gatorade OR gatorade *', , .

+2

, , gatorade, , gatorade, : + (gatorade gatorade *). SolrParser, , .

+2

NGrams TokenFilterFactories, EdgeNGramFilterFactory..

ngrams . 5 ngram 8 : Docum Docume

. Solr : 10 . 5 . 6 .

EdgeNGram , .

, . , ngrams ( ).

+1

, - "Gatorade" ( "G" ), . , schema.xml, , ; . , Solr :

http://solr.pl/en/2010/12/20/wildcard-queries-and-how-solr-handles-them/ ( " Solr " ).

+1

From what I read, wildcards match only words with extra characters after the search query. "Gatorade *" will match Gatorades, but not Gatorade. It seems that Solr has been updated in version 3.6, which takes this into account using a field of type "multiterm" instead of a field of "text".

The best description here:

http://bensch.be/the-solr-wildcard-problem-and-multiterm-solution

0
source

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


All Articles