-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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 facet not work with json attribute when use QueryBuilder #8579
Comments
What whould be valid SphinxQL for your case? |
I have been edit subject above. Is correct SphinxQL: SELECT id FROM product WHERE category_id = 72 ORDER BY date_modified DESC LIMIT 16 FACET attr.fg_3 AS attr_fg_3 ; SHOW META |
You should use $query->facets([
'jsonAttr' => [
'select' => [new \yii\db\Expression('attr.fg_1')]
],
]); |
I get following error: PHP Notice – yii\base\ErrorException
Undefined index: jsonAttr at line 228 in file .../vendor/yiisoft/yii2-sphinx/Query.php |
There must be correspondance between facet name and select expression. $query->facets([
'attr.fg_1' => [
'select' => [new \yii\db\Expression('attr.fg_1')]
],
]); Or use alias for selected expression with facet name: $query->facets([
'jsonAttr' => [
'select' => [new \yii\db\Expression('attr.fg_1 AS jsonAttr')]
],
]); Still there is a bug, which does not respects camel-case facet names. |
Migrated to yiisoft/yii2-sphinx#21 |
Fix and doc updates: |
use php example:
Final SphinxQL:
The text was updated successfully, but these errors were encountered: