I have a couple books on Lucene and Solr, but none of the syntax described in these books seem to work through Drupal/ApacheSolr. Should it be identical? I can't even get the OR operator to work as expected. Perhaps I have to enable/disable something(s) to get the "real" Lucene query interpreter? I feel like my queries are getting parsed by a dumb middleman.

Also, is there a guide to query syntax through ApacheSolr?

Comments

pwolanin’s picture

By default we use the dismax handler which strips all the lucene syntax out.

http://wiki.apache.org/solr/DisMaxRequestHandler

pwolanin’s picture

Status: Active » Fixed

see also: http://wiki.apache.org/solr/SolrQuerySyntax and http://lucene.apache.org/java/2_9_0/queryparsersyntax.html

With Dismax you can use + and - for required or not-allowed terms

Todd Young’s picture

Thanks, that really helps. Is there an alternate handler for search demi-geeks? Or a module to enable crazy queries?

pwolanin’s picture

You can specify an alternate path for a different handler, or specify the &qt=standard parameter

Look at the code for making mlt queries.

Todd Young’s picture

I was reading a number of posts expressing concern at the domino effects related to changing the handler. Is this a quagmire of troubleshooting, or is it just a preference? Could you point me in the direction of where I'd analyze the code to change this?

I sniffed around a few files and it looked quagmirey.

I bet it's not just a matter of changing this setting in the solrconfig xml:

  <requestHandler name="dismax" class="solr.SearchHandler">
    <lst name="defaults">
     <str name="defType">dismax</str>
     <str name="echoParams">explicit</str>
    </lst>
  </requestHandler>
pwolanin’s picture

I you change it for the module as a whole, much will break - e.g. the fact that we search across multiple fields. The dismax handler is designed to take more-or-less unfiltered user input, so you might want to build an additional search form to pass queries to the standard handler.

Todd Young’s picture

I want to go to there. I am trying to put together an application that appeals to both "just find it" commercial users and also very nuts-and-bolts-oriented search wiz's that need (and are very used to) advanced syntaxes, stacked queries, etc...

I will attempt to build a second search form that uses the standard handler. If there are specific files I should examine I'd appreciate knowing which ones. I hope I can get good enough at this to contribute my work.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.