How to return a specified facet bucket when facet.limit is used in Solr - solr

We have a situation where we have a large number of facet buckets for a specific multi-select facet filter, so to make things 'easier' we truncate the returned facet bucket list using facet.limit; showing only the top matches, however, if we apply a filter query for a specific value for that facet the bucket and its count can be missing if they are truncated by the facet.limit, as the count for that selected facet bucket is lower than for other buckets.
i.e.
facet=true
f.category2.facet.mincount=1
f.category2.facet.sort=count
f.category2.facet.limit=4
facet.field={!ex=filter12345}category2
fq={!tag=filter12345}category2:Bottière
As the selected category2 filter value "Bottière" has a low count it is not in the top 4 buckets returned.
Is there a way to always return the category2:Bottière bucket and count while also truncating the list using facet.limit, even if the selcted facet bucket's count is low?

Related

Solr facet count not matching results count due to synonym results

I am running into an issue where I need to match the facet count to the query results count. The problem is that the facet count only matches the searched term, but not the count of results that match the synonyms. For example, I am getting 236 as the facet count, but the results count is 338. Is there a schema setting to include the synonym results in the facet count?

Solr's facet search returns wrong number count without query parameter

I have document with 700k document.
In them, 247 document have country:"FI" field
I set the grouping setting and enable facet on country field
group.truncate=true&
group.ngroups=true&
group.field=ent_id&
group=true&
facet.limit=-1
If I have query
country:*
I have facet return FI=39 (Wrong number)
If I use query
country :"FI"
I have facet return FI=47 (Correct number)
What is the reason for this? My final goal would be a facet query that congregate all the country and their number of appearance

Filter on the list of facet values

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.

Solr cloud result grouping

I have a solr schema which contains few index fields
Now i have different types of products which are distinguished by 'type' field. I want max 50 search results per search request.But the results should contain at least 5 products of each type, if they are part of the search.Say if i search for computer hardware store products, my search result should contain 5 HDDs,5 RAMs,5 CPUs,5 Mother boards etc. if these products are result of search.
In case if total returned rows for certain product type are less then 5, include what ever rows are available.
I have tried facet query and clustering, but could not succeeded.
Any ideas ? How to achieve this ?
Check Solr field Collapsing which will allows you to group results by product type.
Also, you can control the number of groups to be returned and number of entries in per group.

Returning the number of documents in solr when result set is grouped and the group is limited

I am using grouping in solr to determine the number unique values in a specific column and the total number of documents for the query. This number is returned using the group.ngroup=true method in the request. This means the result returns ngroup=30000 and matches=500000
This is good until the number of documents returned per group is limited (and the limit would be fixed). e.g If I were to pull all records (hypothetically I am not saying this will be done) from this result set each group would be limited to group.limit=#
If I am only returning two documents (group.limit=2) per group out of a possible range of documents per group of 1 to 20 this obviously means that the total number of documents returned for this select when limited is between 1*ngroup and 2*ngroup
The question is how do I return the exact number of documents returned based on group.limit? as opposed to the range.
For now, there doesn't seem to be an option to get the exact number of documents returned when we use grouping.
The response field "matches" and "numFound" returns the number of docs
matched but not the number of docs returned in response as per
your limiting based on group.limit parameter.
This could be a "good to have" feature in forthcoming Solr releases.

Resources