0

Does anybody have a hint how to get two different searches on a Drupal 8.8 site?

This means, if a guest uses the search, only pages of type page and article should be listed in the result. If an authenticated user uses the search, all pages of any type should be listed in the result.

In the module description of search_api can be read:

In general, the Search API doesn't provide any kind of access restrictions (as this cannot be done on a generic level). It is therefore your responsibility to take care that only accessible items are indexed or results displayed (e.g., by using appropriate filters).

I understand this in a way that content can be excluded while indexing but not when presented.

DaMa
  • 1
  • 1

1 Answers1

0

You could create 2 Search API Views and grant each access to the relevant roles or permissions with filter to restrict node types in your anonymous user View. If the only difference is access to the node types, then you can just use a single Search API index for both Views.

baikho
  • 5,203
  • 4
  • 40
  • 47
  • 1
    Thank you! It's like magic, but when we looked at the page a day later, it was fine. This looks like the index is created in two stages. Don't know? Your answer sounds good and it will probably be used later. – DaMa Jun 24 '20 at 16:55
  • I see, that sounds much like your index still had items in the queue for indexing – baikho Jun 24 '20 at 17:10