The documentation of the search api module says, about postprocess processor:
Postprocess query
This is probably the rarest phase for processors to use, postprocessing the query after it has run to manipulate the search results in some way. A prominent example would be the "Highlight" processor, which highlights the search keywords in the returned results. But this phase could also be used, for example, to re-run the query completely with some changes in case no results were found the first time.
However, it doesn't explain how to re-run the query completely.
I've to implement exactly in the case described: I've a search api view, with a fulltext search exposed filter and some facets.
If the query returns no results, I need to re-run it with some changes on the conditions provided by one of the facet filters (the content type), before actually rendering the result page.
This must be done programmatically and not by user interaction.
I've checked the ProcessorInterface but the only relative method seems to be the function postprocessSearchResults(ResultSetInterface $results);
.
Highligh, the only processor implementing a postprocess_query
stage doesn't do anything similar at what I need to do.
Any idea how I could re-run the query? I'm on a D9 site. Alternative solutions to the problem would be useful too, I'm trying this way as the documentation gives the idea it is a possible solution.