- Issue created by @prashant.c
- ๐ฆ๐นAustria drunken monkey Vienna, Austria
Iโm not sure what exactly that would entail. The normal autocomplete already uses JSON when retrieving the autocomplete suggestions โ would this new endpoint do the same, and just take the request parameters as JSON instead of as GET parameters?
- Status changed to Postponed: needs info
5 months ago 2:13pm 10 August 2024 - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Also, it seems like this might make more sense as an addition to the JSON:API Search API module โ , not this one. But I might be mistaken. Probably depends on whether this would need to duplicate any of the code in that contrib module.
- ๐ฎ๐ณIndia prashant.c Dharamshala
@drunken monkey
Thanks for the response.
I have not gone through the code of
search_api_autocomplete
module, but as you mentioned if it's already a REST API endpoint in thesearch_api_autocomplete
module then it will make more sense to add the JSON API resource in the JSON: API Search API module to extend it.Thanks, I will give it a try.
- ๐ฎ๐ณIndia prashant.c Dharamshala
I was going through the controller
search_api_autocomplete/src/Controller/AutocompleteController.php
, but does not look like it can act as a method to get JSON results simply because it is expecting arguments asSearchInterface $search_api_autocomplete_search
and it seems expecting a view like an example request issearch_api_autocomplete/search?display=page_1&filter=search_api_fulltext&q=different
.My requirement is to just pass the search index, field(s) which could be only Fulltext indexed fields, and search string, and get the results in JSON format.
Please suggest.
- ๐ฎ๐ณIndia prashant.c Dharamshala
It seems like https://www.drupal.org/project/search_api_decoupled โ module is what could help me, will try this.
Meanwhile, if you have any suggestions for the same please do let me know.
Thanks
- ๐ฆ๐นAustria drunken monkey Vienna, Austria
The Search API Autocomplete module wonโt work if you have no search configured for it. Supported types of searches are search views and pages โ , or anything else for which someone provides a
\Drupal\search_api_autocomplete\Search\SearchPluginInterface
plugin.So, itโs not necessarily based on a view, but it needs to be based on something โ you indeed canโt just pass in the user input and get suggestions without any more setup.