Django-Haystack autoquery gives strange results with solr backend -


i using django 1.5 along haystack 2.1.0.

while using auto-query on 1 of models found following behavior.

test_search = "charles ken"  searchqueryset().models(foo, foosome, foogone).auto_query(test_search)  

the above query gives multiple results.

test_search = "charles k"  searchqueryset().models(foo, foosome, foogone).auto_query(test_search) 

the above query gives no results. doing wrong ?

edit :

the field in concern edge_ngram

<fieldtype name="edge_ngram" class="solr.textfield" positionincrementgap="1">       <analyzer type="index">         <tokenizer class="solr.whitespacetokenizerfactory" />         <filter class="solr.lowercasefilterfactory" />         <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/>         <filter class="solr.edgengramfilterfactory" mingramsize="2" maxgramsize="15" side="front" />       </analyzer>       <analyzer type="query">         <tokenizer class="solr.whitespacetokenizerfactory" />         <filter class="solr.lowercasefilterfactory" />         <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/>       </analyzer>     </fieldtype> 

you need change mingramsize here 1

<fieldtype name="edge_ngram" class="solr.textfield" positionincrementgap="1">       <analyzer type="index">         <tokenizer class="solr.whitespacetokenizerfactory" />         <filter class="solr.lowercasefilterfactory" />         <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/>         <filter class="solr.edgengramfilterfactory" mingramsize="1" maxgramsize="15" side="front" />       </analyzer>       <analyzer type="query">         <tokenizer class="solr.whitespacetokenizerfactory" />         <filter class="solr.lowercasefilterfactory" />         <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" splitoncasechange="1"/>       </analyzer>     </fieldtype> 

but recommend have mingramsize=2 or 3 avoid many indexes.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -