You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Since search can only be used once. This means that searching more than one full-text field is not possible. I opted to default to searching @* (and ignoring the given field name) so that searching more than one field was not only possible but the default.
The ultimate goal will be allowing that syntax as well as:
MyModel.objects.filter(all__search='foo bar')
So that you can search by individual full-text fields or all of them. My use-case dictates that I be able to search all of them. I have no need for searching individual columns. When I have time, I will implement this, but until then, as always, patches are gratefully accepted.
Problem
When filtering by a specific column, the column is ignored.
In this case, the correct SphinxQL query would be:
This default
@*
at the beginning of the query causes problems when using the @-Syntax in the filtering query itself.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.
Additionally, you could add an unfiltered matching function, e.g.
I guess this could be done by adding the function to the custom manager, but I'm not 100% sure about that.
The text was updated successfully, but these errors were encountered: