Wednesday 15 May 2013

search - What's wrong with this Solr range filter query? -


The following filter query returns zero results (*: * as a query):

  - Start date: [* to *] or start: [* So far / day + 1 day]   

But if I only filter them: < Pre> -startDate: <* * * *

I get 3 results.

If I only filter by:

  start date: [* to now / day + 1 day]   

I get 161 results.

Why is the Joint FQ returning zero results? I want the filter to return any doctor whose starting date is zero or the start date is earlier than today.

Edit:

I'm using Solar 4.2.1.2013.03.26.08.26.55

Edit:

Well, the strange thing is that a colleague advised to put brackets on two parts:

  (- Start date: [* From *]) or (Start: [* So far / day + 1 day])   

And somehow it worked. I am still curious why he made a difference? Hope someone can put some light.

Thank you!

Solar supports pure negative queries. They do this, essentially, by expanding the pure negative to something like:

  *: * -startDate: [* TO *]   < P> However, if you add it to boolean, I do not believe it applies more on this kind of argument, a negative query does not bring anything in Lucin, but rather other, positive, query words. Filters that have been matched. This is different from SQL queries, which in a sense starts with a complete table of  *: * , or the result, and allows it to hold it down.  

I believe your or is being effectively ignored, because it is not strictly speaking, it is understandable in context. Generally, or is syntactic sugar, I believe ( field: this or region: that which is equivalent to the field: this field: he ).

Therefore, your query in effect is: start date: [* so far / day + 1 day] -startdata: [* to *] , which results in you being more clearly visible gives . When you wrap it in brackets, then each word query is treated separately, and you gain access to the support of solr of single negative queries.


A better idea is to store a default value, if you need to search for the unset / null values ​​ *: * and thus the pure negative queries like this To scan the entire index in detail, and therefore to perform very poorly. Providing a default value will improve performance, and prevent such a misleading situation.

No comments:

Post a Comment