1

I'm working to create a Search API view. I have an exposed filter that's a fulltext search filter. I'd like to expose another filter that works similar to the exposed entity reference, which allows users to reference multiple tags, separated by commas; the field will then autocomplete the entered value.

Is there a way to achieve this using the Search API Views and the Search API Autocomplete modules? As far as I can see, there isn't a way to autocomplete multiple words/phrases, instead of just the first word/phrase.

1
+50

Add the datasource (entity reference) as a exposed filter. enter image description here

Check the "allow multiple selections".

enter image description here

Now, the user can add comma seperated tags (with autocompletion): enter image description here

Used search api 8.x-1.13 on drupal 8.6.16

0

I would enable the Facet API module first of all, which will give you the facet interaction with Search API.

I would then point you towards a good, simple tutorial at https://medium.com/@swappyp20/creating-a-faceted-search-view-in-drupal-8-using-the-search-api-modules-2b2604ad37f4

Hopefully you should be able to sort it out from there.

  • Indeed. Facets is the way to go here. – Stef Van Looveren May 17 at 10:45
  • Facets would be good if I had 50 or 100 tags, but there are thousands of tags. The autocomplete functionality is really important. There is the "facets autocomplete" module but it's a sandbox module and doesn't seem to work right. – Matt May 17 at 12:02
0

In Filter criteria you need to Add the tag (Taxonomy) fields to extract right values from views. Also remember to select expose this filter to visitors and selection type - Autocomplete and check Allow Multiple Selections. You can see attached screenshots below.

I hope these will help.

enter image description here enter image description here enter image description here enter image description here

  • This is good info about how to add contextual filters to views, but ultimately doesn't answer the question which was how to add autocomplete exposed filters to search_api views. – Matt May 18 at 10:55
  • @Matt I want you to recover your vote!, I edited the answer, it is not difficult to select autocomplete and expose filter to visitors to allow to change it – Alen Simonyan May 20 at 18:13

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.