This could probably be done using a custom QParser plugin? Define the pattern like this:
String queryTemplate = "title:%Q%^2.0 body:%Q%"; then replace the %Q% with the value of the Q param, send it through QueryParser.parse() and return the query. -sujit On Wed, 2011-03-02 at 11:28 -0800, mrw wrote: > Anyone understand how to do boolean logic across multiple fields? > > Dismax is nice for searching multiple fields, but doesn't necessarily > support our syntax requirements. eDismax appears to be not available until > Solr 3.1. > > In the meantime, it looks like we need to support applying the user's query > to multiple fields, so if the user enters "led zeppelin merle" we need to be > able to do the logical equivalent of > > &fq=field1:led zeppelin merle OR field2:led zeppelin merle > > > Any ideas? :) > > > > mrw wrote: > > > > After searching this list, Google, and looking through the Pugh book, I am > > a little confused about the right way to structure a query. > > > > The Packt book uses the example of the MusicBrainz DB full of song > > metadata. What if they also had the song lyrics in English and German as > > files on disk, and wanted to index them along with the metadata, so that > > each document would basically have song title, artist, publisher, date, > > ..., All_Metadata (copy field of all metadata fields), Text_English, and > > Text_German fields? > > > > There can only be one default field, correct? So if we want to search for > > all songs containing (zeppelin AND (dog OR merle)) do we > > > > repeat the entire query text for all three major fields in the 'q' clause > > (assuming we don't want to use the cache): > > > > q=(+All_Metadata:zeppelin AND (dog OR merle)+Text_English:zeppelin AND > > (dog OR merle)+Text_German:(zeppelin AND (dog OR merle)) > > > > or repeat the entire query text for all three major fields in the 'fq' > > clause (assuming we want to use the cache): > > > > q=*:*&fq=(+All_Metadata:zeppelin AND (dog OR merle)+Text_English:zeppelin > > AND (dog OR merle)+Text_German:zeppelin AND (dog OR merle)) > > > > ? > > > > Thanks! > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Understanding-multi-field-queries-with-q-and-fq-tp2528866p2619700.html > Sent from the Solr - User mailing list archive at Nabble.com.