Answer the question
In order to leave comments, you need to log in
When searching across multiple indexes, is it possible to find out the total_found for each index?
There are three indexes a, b, c which are indexes of different tables in the database. When searching across all indices, the result is general information on the query. I would like to get information for each index, how many entries it has.
You can of course make three requests, but maybe there is a more optimal method?
Answer the question
In order to leave comments, you need to log in
It seems that I found the optimal solution, it may be useful to someone.
Enter the index_id attribute in the indexes and fill it in as follows
source a:db
{
sql_query = SELECT *, "a" as index_id FROM table_a
sql_query_info = SELECT * FROM table_a WHERE id=$id
sql_attr_string = index_id
}
$sphinx->SetGroupBy("index_id", SPH_GROUPBY_ATTR, "index_id ASC");
$query_info = $sphinx->Query($query); // 1ый запрос, получаем информацию о запросе
var_dump($query_info);
$sphinx->ResetGroupBy();
$result = $sphinx->Query($query); // 1ый запрос, обычный
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question