On 8/17/2011 6:46 AM, Valentin wrote:
I set the defaultOperator at "AND" in shema.xml :<solrQueryParser
defaultOperator="AND"/>
I use the defType=eDismax in my query. It works very well, but when I want
to use "AND" or "OR" operators, it doesn't use "AND" as the default operator
for the blanks I left without operators.
Examples:
field1:a field2:b does the same thing than field1:a AND field2:b : OK
field1:a OR field2:b : OK, I have all the results that I want
but
field1:a (field2:b OR field2:c) does the same thing than field1:a OR
(field2:b OR field2:c) : that's not OK
How can I force him to use "AND" as the default operator even in that case ?
The dismax and edismax parsers do not respect the default operator in
quite the way you might expect. They give you much more control than
simply choosing one or the other. The value of the mm parameter gives
you very fine-grained control over how much of your query must match the
document. This is particularly useful if the user enters a lot of terms
- you might want only 75% of them to be absolutely required.
http://wiki.apache.org/solr/DisMaxQParserPlugin#mm_.28Minimum_.27Should.27_Match.29
If you simply want to duplicate "AND", set mm=100% either in your query
URL or in your solrconfig.xml request handler definition. According to
the wiki, if you are using 3.1 or later, you could leave mm out entirely
and it will respect the default operator you've defined in your config,
but if you specify a value for mm, it will be used instead.
Shawn