-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong queries created by builder #118
Comments
It seems that the problem is with aliasing the id : |
Am I correct that these versions you've mentioned do not support aliases at all? Or is the problem with using same name for alias? |
@samdark , only SELECT `id` , `name` AS `name`, `entity_id` AS `entity_id`, `entity_type` AS `entity_type` FROM `all` WHERE MATCH('dddddddd* ') p.s. there is no such problem in the modern versions of sphinx (tested on 3.1.1) |
@mgrechanik does it make sense to fix for old versions? |
@samdark they are old versions but many think they are more stable. $query->select('id as doc_id, name, entity_id, entity_type') , so yii2-sphinx does not try to add it's own |
OK. How would you fix it? |
If this line : $columns[$i] = "$column AS " . $this->db->quoteColumnName($i); change to: $columns[$i] = ($i == 'id') ? $column : "$column AS " . $this->db->quoteColumnName($i); error disapears. @klimov-paul , what would you say? |
Looks OK. Do you want to prepare a pull request to speed things up? |
On the second thought this quick guess is not perfect |
Why? |
Because In Sphinx 3 it is possible to use such alias and someone might have used it for some other field. |
What steps will reproduce the problem?
What's expected?
SQL like:
What do you get instead?
And such sql - with aliases which are the same with fields they are for - does not work for sphinx 2.3.2 and two other earlier versions.
One can try such sphinx sql in console, the one with such aliases does not work.
The error is this one:
Additional info
The text was updated successfully, but these errors were encountered: