SolR & wildcard. Allow partial keyword

38 views Asked by At

I'm trying to play with wildcards features in SolR query process I'd like to find all documents containing fran* text in my index.

So, why my wildcard syntax do not work ?

Query Details

Here is my JSON query body request

{
  "params": {
    "q": "fran*",
    "rows":0,
    "defType": "edismax",
  }
}

I expect finding i.e. all documents containing France keyword. But it finds only FRANS / FRAN? items, not any item containing France.

If I query with search query France (without wildcat), it works perfectly.

Index Details

Target fields are indexed as text fields with some filters

<analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.ElisionFilterFactory" ignoreCase="true" articles="lang/contractions_fr.txt"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/custom_stopwords_fr.txt" format="snowball" />
    <filter class="solr.FrenchLightStemFilterFactory"/>
    <filter class="solr.ASCIIFoldingFilterFactory" />
</analyzer>
1

There are 1 answers

0
Kumar On

ElisionFilterFactory and FrenchLightStemFilterFactory stem the terms. So if prefix in your input query doesn't match the stemmed term they won't match.

You can get around it by adding and OR clause between the full term and the prefixed term.

So your new JSON query body should be

{
  "params": {
    "q": "fran OR fran*",
    "rows":0,
    "defType": "edismax",
  }
}