Nope, not possible.

I'm not even sure what it would mean semantically. If you had default operator "OR" ordinarily, but default operator "AND" just for "field2", then what would happen if you entered:

field1:foo field2:bar field1:baz field2:bom

Where the heck would the ANDs and ORs go? The operators are BETWEEN the clauses that specify fields, they don't belong to a field. In general, the operators are part of the query as a whole, not any specific field.

In fact, I'd be careful of your example query:
    q=field1:foo bar field2:baz

I don't think that means what you think it means, I don't think the "field1" applies to the "bar" in that case. Although I could be wrong, but you definitely want to check it. You need "field1:foo field1:bar", or set the default field for the query to "field1", or use parens (although that will change the execution strategy and ranking): q=field1:(foo bar) ....

At any rate, even if there's a way to specify this so it makes sense, no, Solr/lucene doesn't support any such thing.



On 6/7/2011 10:56 AM, Brian Lamb wrote:
I feel like this should be fairly easy to do but I just don't see anywhere
in the documentation on how to do this. Perhaps I am using the wrong search
parameters.

On Mon, Jun 6, 2011 at 12:19 PM, Brian Lamb
<brian.l...@journalexperts.com>wrote:

Hi all,

Is it possible to change the query parser operator for a specific field
without having to explicitly type it in the search field?

For example, I'd like to use:

http://localhost:8983/solr/search/?q=field1:word token field2:parser
syntax

instead of

http://localhost:8983/solr/search/?q=field1:word AND token field2:parser
syntax

But, I only want it to be applied to field1, not field2 and I want the
operator to always be AND unless the user explicitly types in OR.

Thanks,

Brian Lamb

Reply via email to