Skip to content
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

Methods needed for moving from sphinxsearch to Manticore PHP API #60

Open
mikedin opened this issue Aug 28, 2021 · 3 comments
Open

Methods needed for moving from sphinxsearch to Manticore PHP API #60

mikedin opened this issue Aug 28, 2021 · 3 comments

Comments

@mikedin
Copy link

mikedin commented Aug 28, 2021

Hello!

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.

  1. 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?
  2. 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?

@sanikolaev
Copy link
Collaborator

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?

#42

And it's not critical but - can I get primary ids from resultset as array, without array iteration? If can, how called this method?

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
Copy link
Author

mikedin commented 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.

  1. 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?
  2. 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

@sanikolaev
Copy link
Collaborator

Will it works with limits?

Yes, it will, see argument 3 here https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#facet

Which dataset will it use?

Please take this course https://play.manticoresearch.com/faceting to understand how FACET works in Manticore

facets does not return product_id, right?

Yes, that's correct, FACET returns just field value / count

custom weights I can use only via sql, not php api

Correct.

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?

It's not in our nearest plans. PRs are welcome!

this feature is very useful for e-commerce applications, for me like for #42 customer

We do professional services http://manticoresearch.com/services. If it's mission critical for you - contact us.

No, I mean just simple method for ResultSet like $result->getHitIds(); returned just array with doc_id or (as in your code) hit id

Got it, also not in our nearest plans. PR for this would be also appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants