DB stores settings_id as machine name, but rules config sends numeric id for query...

Looking at the table schema, the search_api_saved_searches table stores the settings_id as varchar.

The rules configuration for the "Fetch the saved searches" action stores the search index setting as the numeric ID of the saved search settings.

During rule execution, this numeric settings ID is passed to search_api_saved_searches_get_searches_to_be_executed() which then adds a query condition to compare the numeric settings ID to the settings_id column on the search_api_saved_searches table. Since the field in the DB is varchar, the query always fails.

Comments

ClassicCut created an issue. See original summary.

classiccut’s picture

Here's a patch that fixes the issue by doing an inner join with the search_api_saved_searches_settings table.

drunken monkey’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new2.12 KB
new1.5 KB

Thanks for reporting this problem!
It seems with this bug we're also violating our own documentation (function doc comment), so this is definitely a bug (even though I can't know right now what parameter Rules really passes). However, since changing this now would unnecessarily break compatibility, I think it's a safer idea to allow calls with both machine name and ID. (Also, the machine name is delta, not index_id.)
Please see the attached patch and tell me whether that also resolves the issue for you! (I think it's also cleaner with a separate query instead of a JOIN.)

drunken monkey’s picture

Status: Needs review » Fixed

Well, it seems like it should work, so just committed it.
Thanks again for reporting!

Status: Fixed » Closed (fixed)

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