Answer the question
In order to leave comments, you need to log in
Why is yii2-sphinx not finding columns in sphinx index?
There is a code:
use yii\sphinx\Query;
$query = new Query;
$rows = $query->select('text')
->from('posts')
->all();
var_dump($rows); die();
Database Exception - yii\db\Exception
SQLSTATE[42000]: Syntax error or access violation: 1064 index posts: parse error: unknown identifier 'text' (not an attribute, not a function)
The SQL being executed was: SELECT `text` FROM `posts`
Error Info: Array
(
[0] => 42000
[1] => 1064
[2] => index posts: parse error: unknown identifier 'text' (not an attribute, not a function)
)
source selposts
{
type = mysql
sql_host = localhost
sql_user = uzerrr
sql_pass = pazzz
sql_db = database
sql_port = 3306 # optional, default is 3306
#sql_query = SELECT id, header, text FROM sel_posts WHERE header != 'NULL'
sql_query = SELECT * FROM sel_posts
}
index posts
{
source = selposts
path = /var/lib/sphinx/selectner/posts
charset_type = utf-8
}
Answer the question
In order to leave comments, you need to log in
1 by hand, then what you want to give in the issue must be specified in source
sql_field_string = text
sql_attr_uint = user_id
sql_attr_json = personal_json
sql_attr_timestamp = created_at
2 Use inheritance
source config_mysite
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = mysql
sql_db = new_db
sql_port = 3306
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER SET utf8
}
source mysite_selposts :config_mysite
{
sql_query = \
SELECT `id`, `text` FROM sel_posts
sql_field_string = text
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question