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
for example, I have the fields "brand name", "name" and "product description", "category description", and etc. I would like to select the necessary weights for these fields dynamically. just setting weights for each of the fields before the request. Previously, through sphinxApi, this was done quite simply, but here you need to enter a field and do sorting
I have the fields "brand name", "name" and "product description", "category description", and etc. I would like to select the necessary weights for these fields dynamically. just setting weights for each of the fields before the request
What's interesting is whether and why you really need to be able to set field weights on CLIENT initialization phase or it's sufficient to be able to do it before EACH query. E.g. the likely reason may be that your field weights are constant and you are never going to change them, so you would like to put the to your application config or hardcode in the client initialization code and forget about them in other parts of your app. But it's a little bit in contra with "select the necessary weights for these fields dynamically".
thanks for the answer.
I don’t understand yet how to put weights at the fields correctly. let's just say that I have fields about which I wrote above, when I run a search through php-api, I need to produce first of all fields that are more priority in the field of "category description" since there will be "keywords". and then further on the priority of "product name", "product description".
example of sports nutrition products:
BSN / Sуnta-6 and Isolate / (protein category)
Bombbar / protein cookies / (category cookies)
when searching for "protein" cookies are now in the top. Previously, I remember the opportunity to prioritize the fields when ranking, how to do this with weights - I don’t understand, it’s more likely not to be possible.
upd. I find my old code. i use API ->SetFieldWeights(array (
'field1' => 50,
'field2' => 40,
'field3' => 10,
'field4' => 5,
));
your project will be release his implement? or i can use native php client?
I express my gratitude for the detailed answer, I will try to use sql.
I will rewrite my service.
Is there any hope of future API support in the new client?
Dear devs
i use SQL mode with field_weight ... and now i need FACET , but php client say "multiple queries not supported"
my sql = "SELECT * FROM shop where MATCH('".$text."') limit 1000 option field_weights=(name_tov=40,brand_name=60,category_keywords=80,category_description=20,product_description=10) FACET category_id;"
facet working after update manticore engine from 3.4 to 3.5.4 version.
but php client not support OPTION for field_weights set? may be i can send raw sql ?
I'm reopening it since it was closed by mistake since the original problem was that the php client can't set field weights. It's still so. Let it be open until it's fixed.
Activity
sanikolaev commentedon Jun 8, 2020
Hi
Unfortunately only via https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/sql.md and https://docs.manticoresearch.com/latest/html/sphinxql_reference/select_syntax.html?highlight=field_weights#option
as OPTIONS is not implemented in the JSON interface yet which the php client depends on. I'll keep this issue open until it is.
skvarovski commentedon Jun 8, 2020
thanks for answer.
Is there any hope of implementation when it will be possible to set weights during client initialization through setRanking()?
githubmanticore commentedon Jun 8, 2020
➤ Sergey Nikolaev commented:
Can you elaborate on your use case? Why is it important to have it on the client initialization phase?
skvarovski commentedon Jun 8, 2020
for example, I have the fields "brand name", "name" and "product description", "category description", and etc. I would like to select the necessary weights for these fields dynamically. just setting weights for each of the fields before the request. Previously, through sphinxApi, this was done quite simply, but here you need to enter a field and do sorting
sanikolaev commentedon Jun 9, 2020
What's interesting is whether and why you really need to be able to set field weights on CLIENT initialization phase or it's sufficient to be able to do it before EACH query. E.g. the likely reason may be that your field weights are constant and you are never going to change them, so you would like to put the to your application config or hardcode in the client initialization code and forget about them in other parts of your app. But it's a little bit in contra with "select the necessary weights for these fields dynamically".
Can you provide more details on "here you need to enter a field and do sorting". What exactly do you mean? Using the SQL endpoint https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/sql.md ?
skvarovski commentedon Jun 9, 2020
thanks for the answer.
I don’t understand yet how to put weights at the fields correctly. let's just say that I have fields about which I wrote above, when I run a search through php-api, I need to produce first of all fields that are more priority in the field of "category description" since there will be "keywords". and then further on the priority of "product name", "product description".
example of sports nutrition products:
when searching for "protein" cookies are now in the top. Previously, I remember the opportunity to prioritize the fields when ranking, how to do this with weights - I don’t understand, it’s more likely not to be possible.
upd. I find my old code. i use API ->SetFieldWeights(array (
'field1' => 50,
'field2' => 40,
'field3' => 10,
'field4' => 5,
));
your project will be release his implement? or i can use native php client?
sanikolaev commentedon Jun 10, 2020
Here's how it can be done via SQL:
The functionality
option field_weightsis not available in the new php client, so the only way now to execute the above is by using the sql methodskvarovski commentedon Jun 10, 2020
I express my gratitude for the detailed answer, I will try to use sql.
I will rewrite my service.
Is there any hope of future API support in the new client?
sanikolaev commentedon Jun 10, 2020
Sure, as soon as we add support for the OPTIONS in the JSON interface we'll add it to the client. I'm keeping this issue open until then.
skvarovski commentedon Dec 23, 2020
Dear devs
i use SQL mode with field_weight ... and now i need FACET , but php client say "multiple queries not supported"
my sql = "SELECT * FROM shop where MATCH('".$text."') limit 1000 option field_weights=(name_tov=40,brand_name=60,category_keywords=80,category_description=20,product_description=10) FACET category_id;"
it's time to use JSON API interface ?
sanikolaev commentedon Dec 25, 2020
@skvarovski Hi. Is https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#facet not working for you?
skvarovski commentedon Dec 25, 2020
facet working after update manticore engine from 3.4 to 3.5.4 version.
but php client not support OPTION for field_weights set? may be i can send raw sql ?
skvarovski commentedon Dec 29, 2020
my temporary solution for use Field_Ranking and FACET is sphinx client (yii2-sphinx)... its work for multiple result (data & facet)
sanikolaev commentedon Jan 4, 2021
Yes, you can - https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/sql.md
I'm closing this issue as there seems to be no further work required. Reopen it or create another one if you find more issues with the client.
sanikolaev commentedon Nov 9, 2021
I'm reopening it since it was closed by mistake since the original problem was that the php client can't set field weights. It's still so. Let it be open until it's fixed.
sanikolaev commentedon Sep 18, 2026
This is now supported and can be configured per query:
The value should be passed as an associative array, not as the SQL-style string
(title=20, description=1).The current documentation includes an example here:
https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#option
Closing this as done.