1

I have seen documentation mentioning Sitecore.ContentSearch.SolrNetExtension for Sitecore 9 indicating that its able to group results by a field (ie: _group field). What I am unable to find is a nice and easy way to do this in Sitecore 8. What I had hoped to achieve was to simply append

fq=group=true&group.field=_group&group.main=true

to the query as a FilterQuery. What I have tried thus far has been creating a custom QueryNode called GroupByField(keySelector) to inject a custom SolrQuery into the SolrQueryMapperState.FilterQuery with no luck. I have also tried to use the

.Filter(x => x["group"] == "true" && x["group.field"] == 
    BuildInFields.Group && x["group.main"] == "true")

But that yielded a no field group found which does make sense since it's not a field in the index itself.

TL;DR: Ultimately what I need is, when a User searches a keyword, the search is conducted across all languages and items, but only the items related to the results in the current languages are returned (if I put in a word that is found on the en-gb version of the item, I want the . I assumed this was what the group functionality in Solr was built for. At this point I am considering doing a self join, joining the non-grouped results and matching on the group of a language specific but am not sure that's going to be the solution either.

1

From what I read you dont want grouping (which would be for getting some results for EVERY language

Something like

context.GetQueryable<MySearchResultItem>().Where(item => item.Language
== context.Language)

If you have multiple "current languages" you should have an OR condition on the Where term for multiple languages.

| improve this answer | |
  • Maybe I'll need to update my initial question, but I do want some results from all languages in a sense. I want the current culture variant of any item match in any language. – vandsh Feb 7 '18 at 22:56
  • Then I am not sure of what you are trying to accomplish. Can you add some examples of data and output needed? – Klaus Petersen Feb 21 '18 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.