How to fix count and view pages incorrect when indexing data with multi-term reference fields

Created on 13 October 2023, about 1 year ago

I am sure this is just a config issue and I'm missing something simple....

I have a pretty simple node index. There is a field to a taxonomy term on the node, which can contain multiple values. I need to filter the view based upon the value of the taxonomy term.

So each node typically has two terms references. If I have my view set to 10 items per page, I actually get 5 per page because there are multiple values indexed in Solr. Also the total number of results shown in a facet is double the number of actual nodes.

I realise this is because SOLR is indexing the total number of combinations, so the question is - can we configure the index to group of aggregate the results for a multi-value related field so the total number of unique nodes is correct, but we can still search and filter on the multi-value term field.

I hope I've explained this properly, and thanks for reading!

💬 Support request
Status

Active

Version

4.2

Component

Documentation

Created by

🇬🇧United Kingdom Dubs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Dubs
  • 🇬🇧United Kingdom Dubs
  • 🇩🇪Germany mkalkbrenner 🇩🇪

    This question is not specific for Solr.

    In general it isn't required to index all combinations individually, but one document with a multi valued field.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇦🇹Austria drunken monkey Vienna, Austria

    Are you positive that Solr is indeed indexing all combinations, not creating just one document per entity/translation? (Note that if you have a multilingual site, the Search API will create one search item per language per entity.) Did you look into the Solr index and check there?
    As @mkalkbrenner wrote, this is not the standard behavior, so in that case it would seem some other module is interfering here.

    In case you do have a multilingual site, maybe you are just missing a “current language” filter?

  • 🇬🇧United Kingdom Dubs

    Apologies for taking so long to respond. I've found all I need to do it tick "Unique values filter" in the processors for the index. I can't believe I missed that!

  • 🇺🇸United States banoodle San Francisco, CA

    @dubs I don't have a "Unique values filter" on my search index processors page. I even tried upgrading to the 1.x-dev release, but I still don't have it. Are you using some other contrib module that provides this functionality?

  • 🇺🇸United States banoodle San Francisco, CA

    Oh - you are using SOLR and I am not. I think that is why.

  • 🇫🇷France Jérôme Dehorter Lille

    Hello,
    I don't think this is due to SOLR because I have the same problem with my index search API linked to Database Search and Facet extension.

    I have a multilingual site and to filter by language I change the url /en/jsonapi/index/ and
    /fr/jsonapi/index/ because the langcode facet does not work.

    When I add page[limit]=50 I have 25 items in the data and if I change this limit to 25, I have 13 items while I have 66 in total.

  • 🇦🇹Austria drunken monkey Vienna, Austria

    Did you add a “current language” filter to your view?

  • 🇬🇧United Kingdom Dubs

    Hi - I'm sorry for not responding sooner - I am sure I did!

    What was missing was to tick the dedupe filter - can't believe I missed it!

    This can be closed now.

  • 🇬🇧United Kingdom Dubs
Production build 0.71.5 2024