: When I'm using a dismax query handler, I'm having trouble doing
: queries like this:
:
:       category:fruit apple

: The dimax query handler docs (http://wiki.apache.org/solr/
: DisMaxRequestHandler) make reference to special chars being escaped,
: so I'm wondering if the ':' qualifier is being made into something
: useless.

yeah ... the dismax handler is designed this way -- it doesn't support the
full syntax of the lucene QueryParser, instead it treats the text input as
literal text the user is searching for, and looks for it across all of the
fields configured in the qf.

If your goal is to search for "apple" and restrict the results to things
in the category "fruit" then you can use the fq (Filter Query) param to
specify a regular QueryParser like query to define a super set of all
legal results (ie:  "qt=dismax&q=apple&fq=category:fruit") ... this has
two benefits over doing the same type of thing with StandardRequest
handler:
  1) The tf of the Term category:fruit doesn't affect the scores of
     results, they are judged entirely on the merrit of the word "apple"
  2) The fq is used to build a DocSet which is cached, so the next time
     you do a query with teh same restriction
     (ie: "qt=dismax&q=banana&fq=category:fruit") only the "banana" part
     of your query needs to be computed.

If your goal is to search for "apple" and have items in the result which
match category:fruit get better scores then items which don't, then use
the bq (Boost Query) param in the same way as the fq param above ...
again, the full lucene QueryParser syntax is supported.



-Hoss

Reply via email to