I don't use dismax, but do something similar with a regular query. I have a
field defined in my schema.xml called 'dummy' (not sure why its called that
actually) but it defaults to 1 on every document indexed. So say I want to
give a score bump to documents that have an image, I can do queries like:

q=Some+search+text+AND+(has_image:true^.5 OR dummy:1)

I'm doing that from memory haven't actually tested so my syntax may be off,
but i hope you get the idea. Basically the first part of the OR query in
parenthesis is your optional nested query, if it fails, or even if the
document doesn't have a field called has_image at all, the dummy:1 will
always pass.

Ken

--
View this message in context: 
http://lucene.472066.n3.nabble.com/optional-nested-queries-tp3128847p3129064.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to