You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Methods needed for moving from sphinxsearch to Manticore PHP API #60
I'm moving from sphinxsearch and can't find several features at php api for manticore. Try to make samples with sphinx 2.0 php code.
SetGroupBy method for grouping results. as far as I understand, this feature is present in manticore and maybe this feature covers by facets, but this is not covers by documentation. Please, explain - how can I group results?
Set weights for fields for using custom order and ranges via SetWeights. As I read in documentation, manticore has custom weights feature via SELECT OPTIONS in SQL, but I can't find this method in php api. Not as method, not as, I don't know, some options of connection or something like that. How can I set this?
And it's not critical but - can I get primary ids from resultset as array, without array iteration? If can, how called this method?
SetGroupBy method for grouping results. as far as I understand, this feature is present in manticore and maybe this feature covers by facets, but this is not covers by documentation. Please, explain - how can I group results?
Set weights for fields for using custom order and ranges via SetWeights. As I read in documentation, manticore has custom weights feature via SELECT OPTIONS in SQL, but I can't find this method in php api. Not as method, not as, I don't know, some options of connection or something like that. How can I set this?
You offer facets for php api instead groupby, but it's not similar, right? How facets works? I don't see it in documentation, try to explain.
select brand_id from products group by brand_id limit 5.
mysql and sphinx api via SetGroupBy first select all brand_id, then returns first 5 of it.
But facets return in another structure! Will it works with limits? Which dataset will it use? I mean, facets works with all index or with results of query only, as aggregation from query result?
select product_id, brand_id from products group by brand_id
mysql and sphinxapi returns product_id, one (first?) for each brand_id and it's useful case. facets does not return product_id, right?
As I understand, custom weights I can use only via sql, not php api. Do you have a plan for this feature? #42 was opened more than year ago, have you this feature in php api roadmap or not?
As example, I can say, that this feature is very useful for e-commerce applications, for me like for #42 customer.
No, I mean just simple method for ResultSet like $result->getHitIds(); returned just array with doc_id or (as in your code) hit id
@marclaporte You are right, I don't remember all details that I have 5 years ago, but I solved +- all my questions. Don't ask how, it was a long time ago.
I've read ticket again now, and still think if you have setWights alternative in sql, it would be nice to have it in php too - make sql string with a lot of fields in different places (usual case when create search request) is ugly way. One PHP call is much more nice.
But you can close ticket, anyway.
This is suitable for retrieving group values and document counts. For full SQL GROUP BY semantics, such as selecting a representative document from each group, use the SQL endpoint.
ResultSet does not currently have a getHitIds() helper. IDs can be collected as follows:
Activity
sanikolaev commentedon Aug 30, 2021
#42
I don't think you can avoid iteration completely, but you can use
https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#setsource to avoid getting unneeded fields.
mikedin commentedon Aug 30, 2021
Thanks for answer. But I have some additions
You offer facets for php api instead groupby, but it's not similar, right? How facets works? I don't see it in documentation, try to explain.
mysql and sphinx api via SetGroupBy first select all brand_id, then returns first 5 of it.
But facets return in another structure! Will it works with limits? Which dataset will it use? I mean, facets works with all index or with results of query only, as aggregation from query result?
mysql and sphinxapi returns product_id, one (first?) for each brand_id and it's useful case. facets does not return product_id, right?
As I understand, custom weights I can use only via sql, not php api. Do you have a plan for this feature? #42 was opened more than year ago, have you this feature in php api roadmap or not?
As example, I can say, that this feature is very useful for e-commerce applications, for me like for #42 customer.
No, I mean just simple method for ResultSet like $result->getHitIds(); returned just array with doc_id or (as in your code) hit id
sanikolaev commentedon Aug 31, 2021
Yes, it will, see argument 3 here https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#facet
Please take this course https://play.manticoresearch.com/faceting to understand how FACET works in Manticore
Yes, that's correct, FACET returns just field value / count
Correct.
It's not in our nearest plans. PRs are welcome!
We do professional services http://manticoresearch.com/services. If it's mission critical for you - contact us.
Got it, also not in our nearest plans. PR for this would be also appreciated.
marclaporte commentedon Sep 10, 2026
@mikedin I know it has been 5 years but I am doing some housecleaning here :-) What is latest status for you?
Manticore has had multiple innovations and releases:
https://github.com/manticoresoftware/manticoresearch/releases
mikedin commentedon Sep 10, 2026
@marclaporte You are right, I don't remember all details that I have 5 years ago, but I solved +- all my questions. Don't ask how, it was a long time ago.
I've read ticket again now, and still think if you have setWights alternative in sql, it would be nice to have it in php too - make sql string with a lot of fields in different places (usual case when create search request) is ugly way. One PHP call is much more nice.
But you can close ticket, anyway.
sanikolaev commentedon Sep 18, 2026
Thanks for the update. Since your original migration has been completed and you confirmed that the issue can be closed, I'm closing it.
For anyone finding this issue later, the current status is:
Field weights are now supported directly by the PHP client:
(docs: https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#option)
Basic grouping and counts are available through
facet()and the aggregation API:https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#facet
This is suitable for retrieving group values and document counts. For full
SQL GROUP BYsemantics, such as selecting a representative document from each group, use the SQL endpoint.ResultSetdoes not currently have agetHitIds()helper. IDs can be collected as follows:A dedicated
ResultSet::getIds()method can be proposed separately if there is still demand for that. PRs are welcome.