Filtering search results with django-haystack / solr produces solr syntax error -


i think may have identified bug in haystack / solr i'm not sure , wanted see if i'm doing wrong first. i'm using:

django 1.8 haystack 2.4.1 solr 4.10.4

when try filter searchqueryset, solr complains of invalid syntax on filter query genenerated haystack. bizarrely, stepping through code in pdb works, fails under normal circumstances. relevant portion of code is:

    # built query string resolves     applicable_filters = {'job_type__in':['pe', 'te'], 'sector__in':['12','13']}      # query.     sqs = searchqueryset().models(self._meta.queryset.model).filter(**applicable_filters).order_by(order).load_all().auto_query(request.get.get('q', ''))     if not sqs:         sqs = emptysearchqueryset() 

when executing query, solr throws following:

[vagrant@127.0.0.1:2222] out: failed query solr using '(job_type:("pe" or "te") , sector:("12" or "13") , )': [reason: org.apache.solr.search.syntaxerror: cannot parse '(job_type:("pe" or "te") , sector:("12" or "13") , )': encountered " ")" ") "" @ line 1, column 55. 

as can see, appears haystack ( or perhaps pysolr ? ) adding , clause solr query, seems wrong. bizarre bit if step through same function in pdb works.

am @ loss....

fixed.

problem was passing empty string final auto_query() clause. i've migrated whoosh backend , seems more tolerant of empty search string solr.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -