1

I have a solr search index set up and a view to search content.

We have "Region" groups for members so they only see content from their region.

The search works great as admin who has access to every region, but as a user the results page just hides what they can't access without filling the rest of the spaces with results.

So this ends up showing:

page 1 - 5 results, page 2 - 3 results, page 3 - 15 results, etc

So essentially it has the same amount of pages as the admin search, but the results they don't have access to just don't show.

How can I make it so that the results pages will always fill to 30 with content they are allowed to access before starting a new page instead of having 20 pages with random amounts of results?

Thank you for your help.

Module info:

Search API: 8.x-1.28

Search API solr: 4.2.10

Search API Sorts: 8.x-1.1

Facets: 2.0.1

Database Search: 8.x-1.28

4
  • Can you add to the question details about the Solr integration? By that I mean, the search integration modules and their versions. Also tag this question with the Drupal major version, like "7" or "10", which by the way are the only currently-supported major versions.
    – mona lisa
    Nov 17, 2023 at 13:32
  • Sorry I missed that, I have added the module info. Is there any way of filtering by group that the user is a part of? Nov 20, 2023 at 13:15
  • @JamesPrunty Is the Region field set on the User entity? Or are User entities added to a field on a Region taxonomy term or something? It depends how it's implemented, but yes, you should be able to filter the results to only include the region(s) the current user is in.
    – mbomb007
    Nov 21, 2023 at 17:52
  • Thank you for your help. The users and content are added to the group as entities in the group by relationship. There are no fields on the users, groups or content that set the region they are part of, so I can't use a field to get the info. What would be great is if I can somehow query the group relationship so I can add it as a condition. I have the user group IDs using \Drupal::service('group.membership_loader')->loadByUser(), but am not sure how to get the content group ID to add into a condition for filtering. Hopefully that makes sense. Nov 22, 2023 at 11:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.