0
votes

Could you say why I have empty searching results.

Say, I have the following document in Solr:

{
  "srcphrase": "in case if",
  "id": "d77a6c9e463652c9",
  "_version_": 1479240921712164900
}

In my schema.xml:

<field name="id"
       type="string"
       indexed="true"
       stored="true"
       required="true"
       multiValued="false" /> 
<field name="srcphrase"
       type="text_en"
       indexed="true"
       stored="true"/>
...
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
    <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
    <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
</fieldType>

When submitting the query localhost:8983/solr/collection/select?q=srcphrase%3A%22in+case+if%22 I get empty results. Here is what analysis show:

enter image description here

Do you have some ideas why I have empty results for existing phrase?

1
is there any error message on console ?akshayb
No errors on the console. Solr returns 200 OK with the response body: { "responseHeader":{ "status":0, "QTime":1, "params":{ "indent":"true", "q":"srcphrase:\"in case if\"", "_":"1410774019156", "wt":"json"}}, "response":{"numFound":0,"start":0,"docs":[] }}Maksim
try moving quotes (%22) from url.akshayb
If omit the quotes, Solr returns confusing results: "inning", "inning" "INS" ...Maksim
try using AND operator or use solr proximity search (using ~) to get accurate results.akshayb

1 Answers

0
votes

Seems now the problem is solved for me. I have already tried to re-index the documents, but after I have re-indexed the core once again, Solr starts returning the results.

query: srcphrase:in AND srcphrase:case AND srcphrase:if, the phrase found

query: srcphrase:"case if in"~3, the phrase found

query: srcphrase:"in case if", the phrase found

query (as suggested by akshayb): srcphrase:in AND case AND if, the results are empty

So re-indexing the documents matters if you change the chain of filters for index analyzer. To re-index the documents it is needed:

  1. To remove all the existing documents

    curl http://{host}:{port}/solr/{collection}/update -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
    
  2. To submit the documents once again, e.g.:

    java -Durl=http://{host}:{port}/solr/{collection}/update -jar /path/to/solr/post.jar my-doc.txt