I am trying to learn about the Sphinx search server. I have it working through the command line and through PHP. The only nagging thing is that when I index a table, Sphinx returns a notice that says it could not find the Primary Key column and 'ignores' that column. It works anyway, so I did not pay that much mind, but now I've noticed that I am getting PHP notices from my search script saying that the primary key column q_id is undefined. The script works and returns the proper q_ids but I do not like getting the notices.
Here is a snippet so you can see where I am trying to get the primary key column.
$row_ids = array();
if ( ! empty($result["matches"]) ) {
foreach ( $result["matches"] as $doc => $docinfo ) {
array_push($row_ids, $docinfo['q_id']);
}
I understand that Sphinx does not recognize what a Primary Key is, but I figured it could still index the column, and it must do something with it because searches are returning the correct q_ids. Where am I wrong? Thanks.
Is "q_id" an attribute?
Would be something like
foreach ( $result["matches"] as $doc => $docinfo ) {
array_push($row_ids, $docinfo['attrs']['q_id']);
}
You should do a print_r($result); to see everything returned...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.