Skip to content
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

Sphinx Query Error #9

Closed
Hector68 opened this issue May 9, 2015 · 3 comments
Closed

Sphinx Query Error #9

Hector68 opened this issue May 9, 2015 · 3 comments

Comments

@Hector68
Copy link

Hector68 commented May 9, 2015

Work

 $query->select(['id', 'title', 'price', 'product_category', 'product_properties'])
            ->from('products')
            ->limit(40)
            ->where('product_category=:product_category AND product_properties=:product_properties')
            ->params(
                [
                    ':product_category'=>5,
                    ':product_properties' => 5
                ]
            )
            ->all()

Dont't work

  $query->select(['id', 'title', 'price', 'product_category', 'product_properties'])
            ->from('products')
            ->limit(40)
            ->andWhere(
                [
                    'product_category'=>5,
                    'product_properties' => 5
                ]
            )
            ->all()

SQLSTATE[42000]: Syntax error or access violation: 1064 sphinxql: syntax error, unexpected '(', expecting IDENT (or 5 other tokens) near '(product_category=5) AND (product_properties=5) LIMIT 40'
The SQL being executed was: SELECT id, title, price, product_category, product_properties FROM products WHERE (product_category=5) AND (product_properties=5) LIMIT 40

@klimov-paul
Copy link
Member

Unable to reproduce.
I have added extra unit test to cover this: 298cfb7 . It passes correctly.
It must be something wrong with your Sphinx server.

@truth4oll
Copy link

Have the same error, the reason is bracket

$query->select('id')
            ->from('catalog_place')
            ->match($search)
            ->andWhere(['location_id'=>Location::getLocation()->id])
            ->all();

generates:

SELECT `id` FROM `catalog_place` WHERE (MATCH('search')) AND (`location_id`=536)

and get error:

sphinxql: syntax error, unexpected '(', expecting IDENT (or 5 other tokens) 

but this work fine:

SELECT `id` FROM `catalog_place` WHERE MATCH('search') AND `location_id`=536

@little-bit-shy
Copy link

where() is success;
the andWhere() and andFilterWhere() is fail;
the reason is bracket;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants