I use search_api_db to execute my searches. I had an infinite recursion in the "create_keys_query" when my search terms contained stopwords. While debugging, I noticed that "processor_stopwords" - "process" unsets the value of the stopword term in the "filters" array (in processor.inc - processFilters) but the entry in the filters array is retained (with an empty value). This causes an infinite recursion as mentioned before. I fixed this by unsetting the entry in the filters array when the value is emptied by a processor , which can be reviewed in the patch I've attached.

Comments

Status: Needs review » Needs work

The last submitted patch, search_api_stopwords_processor_infinite_recursion.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new3.57 KB

Thanks for reporting and even providing a patch! Your approach looks already very good, but it has a serious flaw: you'd also sort out all filters for 0, no matter whether the filter value was actually changed. It is also possible to filter for NULL values, which your patch would forbid, too.
Attached is a patch that tries its best to avoid any unwanted side effects. Filters are only excluded when the value was changed to an empty string (not 0, NULL, FALSE, …).
Thinking about it, I also realized that processors would currently also work on these non-string values and convert them to strings, thus resulting in possibly wrong queries (e.g., when NULL is replaced by an empty string). This should be fixed by the attached patch, too.
Please test whether this works for you!

Also, please always create patches relative to the module's directory, not your web root. See the handbook for details.

drunken monkey’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
johanpieck’s picture

Hello drunken monkey, I can confirm this patch works. Thanks!
I realized that my patch contained corrupt paths and was in the process of creating a new one, but you were faster :-).

drunken monkey’s picture

Status: Needs review » Fixed

Thanks for testing, and thanks again for your patch!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.