I have not found any example for overlapping range based facets
Do solr even support overlapping range facets? example, something like : [0-10],[5-15],[10-20]
Well a facet is a filter, so if you add multiple, separate range filters you're essentially saying "filter for values 0-10 and filter for values 5-15". So only the values in range 5-10 satisfy both those filters and that's all you'll get. If you want results that satisfy any of the ranges, you could join them into a single facet query parameter with an OR operator, e.g.
fq = count:[0 TO 10] OR count[5 TO 15]
and that's the same as filtering count:[0 TO 15]. Just depends what kind of functionality you expect from overlapping ranges.
Related
I have a 'keywords' field in my index, which is Facetable, and of type Collection(Edm.String).
In my UI I show a facet for this fields which returns the top 10 keywords.
The total number of distinct keywords value may be many hundreds.
So I would like the user to be able to enter a term, and the top 10 facet values containing this term would be returned.
So this is kind of filtering the list of facet values for a field.
Is this currently possible with Azure Search API ?
No, this is not supported. It's possible to filter the set of documents returned, which will influence the facets that are returned, but there is no way to directly filter the facet values themselves using a search expression or "contains" semantics.
You could filter on your keywords field, but then you'd only get the matching facet value, not the top 10 facet values that contain a search term.
So I read this: http://wiki.apache.org/solr/SolrCaching#filterCache
and specifically
The filter cache stores the results of any filter queries ("fq"
parameters) that Solr is explicitly asked to execute. (Each filter is
executed and cached separately. When it's time to use them to limit
the number of results returned by a query, this is done using set
intersections.)
So my question is this. Lets say my app filters on a set of different formatsIDs. If the format ids are numeric say 1,2,3,4,5. And there are many permutations of those being sent in queries as fq parameters.
if I wrote a warming query like this...
...
<str name="fq">format:(1)+OR+format:(2)+OR+format:(3)+OR+format:(4)+OR+format:(5)</str>
...
Would that warm things up and help all my queries trying to filter by various permutations of those formats OR... only folks searching for that permutation?
Should I instead create 5 separate warming queries (1 for each format) to take advantage of "set intersection"?
Or will that query create the sets for each format?
Example queries
...fq=format:(1)+OR+format:(2)...
...fq=format:(1)+OR+format:(3)...
...fq=format:(2)+OR+format:(3)...
...fq=format:(2)+OR+format:(5)...
etc...
so none of those I believe will use the filter cache created by the warming query listed above.
See https://wiki.apache.org/solr/CommonQueryParameters#fq. It says:
The document sets from each filter query are cached independently.
Thus, concerning the previous examples: use a single fq containing two
mandatory clauses if those clauses appear together often, and use two
separate fq params if they are relatively independent.
It is one cache entry per fq param specified in your query.
You are not doing set intersection with OR; you are doing set union. But if you were doing set intersection like:
fq=format:(1 AND 2 AND 3 AND 4 AND 5)
(assuming format is a multi-valued field here) and have different subsets of those 5 values like
fq=format:(1 AND 2)
fq=format:(3 AND 4 AND 5)
then issuing separate filter queries like:
fq=format:1&fq=format:2&fq=format:3&fq=format:4&fq=format:5
will help all the subset queries. Here you will have 5 entries in the filter cache and they are intersected for all the subsets.
Regarding permutations i.e. the order in which the values appear in the filter query, I believe it will use hashing for the fq param, so you are better off sorting the values first and then forming your filter query.
I'm creating a uneven range facet and I want to support multiple selection for it. However, facet on the tags/exclusions for filters stop working.
Following is my price facet ranges
0-20
20-50
50-100
100-*
Initially I am populating above range with using facet query.
Now whenever end user are selecting 0-20 and 20-50,
I am generating the following
http://localhost:8983/solr/catalog/select?q=games&facet=true&wt=xml&rows=0& fq={!tag=salePrice}salePrice:[0 TO 20]&facet.query={!ex=salePrice}[0 to 20]& fq={!ex=salePrice}salePrice:[20 TO 50]&facet.query={!ex=salePrice}[20 to 50]& other params.
& system is returning zero results.
I am seeing following SOLR JIRA bug closed as fixed.
https://issues.apache.org/jira/browse/SOLR-3819
However, in case,only one facet.query is in action.
In my example, i am using multiple facet.query with uneven ranges.
Please help.
Your query has two fq clauses that don't overlap. That is why you get zero results — nothing to do with the facets or tags themselves. For multi selection you need to combine them with an "OR".
Instead of
...&fq={!tag=salePrice}salePrice:[0 TO 20]&...&fq={!ex=salePrice}salePrice:[20 TO 50]&...
you want
...&fq={!tag=salePrice}salePrice:[0 TO 20] OR salePrice:[20 TO 50]&...
(or combine into a single range)
I'm using Solr 4.3. I have built range facet for field price, for which I gave a f.price.facet.range.start, a f.price.facet.range.end and f.price.facet.range.gap, but I cant figure out how to compute the facet for values inferior or superior to a certain value.
Maybe I dont know the exact syntax : f.price.facet.range.other.before=1000000.
According to the documentation on on Facet Range Other, this will only work for values that fall within the range being computed. So for your example, if 1000000 is not within your current range start/end values, you will not get a result from the range.other.before parameter. However, you can still get the facet for this price, by including it as a separate facet.query request.
For your example, you would include te following parameter:
facet.query=price:[* TO 1000000]
Using Solr 4.3
I have a field "digest" in a solr index - and I would like to execute a query that will return me all the cases where there are duplicate values of digest. Can this be done?
For the records that have duplicate values, I would like to return other values - such as "url" which may not be duplicated.
You have two options, neither perfect.
You can use Grouping/Field Collapsing which will group by digest and can give you other fields, but does not allow you to avoid groups with only 1 element.
Or you can use Facets, which allow you to specify minimum number of elements for that facet value, but do not allow you to see which documents match that facet. Though you might be able to get something useful by using Pivot (nested) facets.