You might be able to do something like this in a custom QParser.  look at 
the LuceneQParser as an example, but replace usages of QueryParser with 
your own subclass of QueryParser where you override the getBooleanQuery 
method and muck with the Occur property of the BooleanClauses if they all 
have the same field.

the thing you might not want though is that by the time you get to that 
part of the API there's no way to tell the diff between...

        field1:foo field1:bar
        field1:(foo bar)

...not sure if you care.

you'd also have to consider what you want to happen if some one entered...

        field1:foo field1:bar field1:baz field2:xxxxxx

...because at that layer of the API it's a sigle list of BooleanClauses.

Another thing to consider is that the new QueryParser framework might make 
dealing with this a lot easier (but i'm jues guessing, i'm not really 
familiar with it)...

http://lucene.apache.org/java/3_2_0/api/contrib-queryparser/index.html


: > >> field1:foo field2:bar field1:baz field2:bom 
: > >>
: > >> would by written as
: > >>
: > >> http://localhost:8983/solr/?q=field1:foo OR field2:bar OR field1:baz OR
: > >> field2:bom
: > >>
: > >> But if they were written together like:
: > >>
: > >> http://localhost:8983/solr/?q=field1:(foo baz) field2:(bar bom)
: > >>
: > >> I would want it to be
: > >>
: > >> http://localhost:8983/solr/?q=field1:(foo AND baz) OR field2:(bar OR
: > bom)



-Hoss

Reply via email to