How to specify defType for SolrInterface.query ?

69 views
Skip to first unread message

Wade Leftwich

unread,
Sep 8, 2012, 11:22:07 AM9/8/12
to python-...@googlegroups.com
I have just started using the excellent Sunburst library to work with a Drupal Solr catalog, which has the default query parser set to dismax.

I can search on a particular field using the SolrInterface.search() method if I include a 'defType' param, like this:
    In [46]: len(list(si.search(q='title:Fido', defType='lucene')))
    Out[46]: 2

Or I can use SolrInterface.query() to do a dismax search using the schema.xml settings, like this:
    In [48]: len(list(si.query('Fido').execute()))
    Out[48]: 10

But when I try to specify a field to search using the query method, it doesn't work:
    In [47]: len(list(si.query(title='Fido').execute()))
    Out[47]: 0

Is there a way to tell SolrInterface.query() that I want to use the Lucene query parser?

Any help appreciated.

Wade Leftwich
Ithaca, NY







Wade Leftwich

unread,
Sep 8, 2012, 7:27:59 PM9/8/12
to python-...@googlegroups.com
Probably not _the_ way to do it, but a reasonably simple way:
    In [40]: q = si.query(title='Fido') 

    In [41]: len(si.search(defType='lucene', **q.options()))
    Out[41]: 2
Reply all
Reply to author
Forward
0 new messages