On 4/24/2013 12:13 PM, Brian Hurt wrote:
If the boolean layout you have is really what you want, then you need to
change the negation queries to (*:* -query) instead, because pure
negative queries are not supported.  That syntax says "all documents
except those that match the query."  For simple negation queries, Solr
can figure out that it needs to add the *:* internally, but this query
is more complex.

This could be the problem.  This is query is machine generated, so I don't
care how ugly it is.  Does this apply even to inner queries?  I.e., should
that last clause be (*:* -i_4:6142E=m") instead of (NOT I-4:"6142E=m")?

Exactly right.

I wash all strings through ClientUtils.escapeQueryChars always, so this
isn't a problem.  That string should just be "1yyy~", the ~ was getting
escaped.

A quick check with debugQuery seems to confirm my thoughts on this - if you have the quotes, the escaping isn't necessary, although including it appears to be working correctly too. Depending on exactly what field type you have, you might be good there.

Don't use quotes unless you really are after phrase queries or you can't
escape special characters.  You might actually need phrase queries for
some of this, but I would try simple one-field queries without the
quotes to see whether you need them.  I have no idea what happens if you
include quotes inside a range query (the "6114"), but it might not do
what you expect.  I would definitely remove the quotes from that part of
the query.

This is another solid possibility, although it might raise some
difficulties for me- I need to be able to support literal string
comparisons, so I'm not sure how well this would support the query s_7 <=
"some string with spaces" sorts of queries.  But some experimentation here
is definitely in order.

Due to the query parser trying to be smart, quotes appear to be necessary if spaces are part of your indexed values and your query.

Since I now know that you don't want to negate the range query, it makes sense for me to tell you that a value of 611A is outside the range [* TO 6114], because numbers are "lower" than letters when doing string comparisons. This was why I thought you might be trying to negate the entire query clause - it's the only way that particular piece would match.

Thanks,
Shawn

Reply via email to