Faceting before collapse in Solr - solr

I am using CollapseQueryParser Plugin in Solr to collapse results across one common field.
Quoting the official Solr Documentation -
This parser collapses the result set to a single document per group before it forwards the result set to the rest of the search components. So all downstream components (faceting, highlighting, etc.) will work with the collapsed result set.
There are multiple facet fields in the query, and for one particular facet, I need to do the faceting or aggregation before the collapse happens and as usual for others. I tried excluding it with a tag and using collapse.facet=facet.before, but these didn't work.
Is there any way to do this in Solr? I am using Solr-7.7.2.
Thanks in advance!

As mentioned in the comments, I found a way to handle this. Posting this for someone who might encounter this in future.
I had to tag the collapse query seperately and then use that tag wherever i needed exclusion as shown below.
While collpsing -
fq={!tag%3DcollapseTag}{!collapse+field%3Dcollapse_field+nullPolicy%3Dignore+cache%3Dfalse}
And while faceting -
facet.field={!ex%3Dfksize,collapseTag}size_string_mv

Related

Returning price and thumbnail info from solr suggester

I am using the solr (6.5.1) suggester to return autocomplete results.
I am trying to display a price and a thumbnail with the autocomplete results but can't find a way to do this.
Is there a way to return more fields?
I see these two questions from two years ago that seem to be trying to accomplish what I want, and both say that at the time it is not doable.
Solr Suggestion with multiple payloads
Returning an entire Document on Solr Suggestion
Has anything changed since two years ago?
Is there a different way that this can be accomplished?
just put all info you need into a field, and use that field as payload. For example you could:
append some string info, separated by |: payload:"17|/path/to/thumbnail"
or you could use Solr BinaryField and put a Java pojo containing the info you need there serialized
I would go the simple route, the first one.

Wagtail filtering on fields in subclasses of Page

I've been searching the documentation trying to understand if I can filter on page subclass fields the same way I can search on them.
From my experiments search filters must contain only the fields that are defined on the filtered type.
Is this the case? If so, is there any plans on implementing such a thing?

Is there an option to toggle stemming in Solr?

I would like to have an option to turn stemming on and off in my searches using some toggling options. How can I do that ?
Thanks,
N
One good option would be to store the value in two fields: one that uses a stemming analyzer and one that does not. You can use the <copyField> element to accomplish this. Your application could then choose which field to use during search.

Get only one matching row from Solr array

How do I get only a row which matches my query: ?q=taxonomy_ids:1/636/*
Got that result:
Want only: <str>1/636/587</str>
There is no easy way. However, there is a trick, where you use a match highlighter and use those results instead of the results returned from the search itself. You may want to configure PRE/POST highlight tags to empty strings. There was an article on the web about somewhere, but I can't find it again.
The disadvantage is that you get your results twice. Once as docs and once as highlight.
The other option is a custom component that hooks into Lucene's explain structure.

Drupal 7 views filter by node's taxonomy term

I have a similar question to my previous one (Drupal 7 views filter by dynamic taxonomy term), it's only the other way round.
I have a "partner" content type, each with it's own taxonomy term. The other content type is a regular page with multiple terms from the "partner" vocabulary. In my regular nodes, I want to include a few of the "partners" in a view block.
The view should filter only those relevant partner nodes (those tagged with one of the regular node's tags).
Could it be done this way? The problem is that I can't get the term names from URL via contextual filters...
After googling the whole afternoon (and posting it there), I eventually found the answer.
It's based on a tutorial on scito.ch (thanks), with only a few modifications. On the Content: Has taxonomy term ID (with depth) filter, be sure to check the Allow multiple values checkbox. Also (there's a lot of wrong tuts for that), don't specify anything in the WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED. It's important you specify all those 3 contextual filters.
Hope this helps someone and saves him a sunny afternoon :)

Resources