Open
Description
Problem
When filtering by a specific column, the column is ignored.
>>> CompanyIndex.objects.filter(company_name__search='my company')
SELECT `id`, `customer_id` FROM companies_rt WHERE MATCH ('@* my company') LIMIT 21
In this case, the correct SphinxQL query would be:
SELECT `id`, `customer_id` FROM companies_rt WHERE MATCH ('@company_name my company') LIMIT 21
This default @*
at the beginning of the query causes problems when using the @-Syntax in the filtering query itself.
>>> CompanyIndex.objects.filter(company_name__search='@company_name my company')
SELECT `id`, `customer_id` FROM companies_rt WHERE MATCH ('@* @company_name my company') LIMIT 21
This fails of course.
Suggestion
I'd suggest that the standard query filtering accepts only basic syntax, no field names. It should also limit the filtering to the specified column name.
>>> CompanyIndex.objects.filter(company_name__search='my company')
SELECT `id`, `customer_id` FROM companies_rt WHERE MATCH ('@company_name my company') LIMIT 21
Additionally, you could add an unfiltered matching function, e.g.
>>> CompanyIndex.objects.match('@* software @city new york')
I guess this could be done by adding the function to the custom manager, but I'm not 100% sure about that.
Metadata
Metadata
Assignees
Labels
No labels