GithubHelp home page GithubHelp logo

Comments (15)

sanikolaev avatar sanikolaev commented on July 28, 2024

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.

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

thanks for answer.
Is there any hope of implementation when it will be possible to set weights during client initialization through setRanking()?

from manticoresearch-php.

githubmanticore avatar githubmanticore commented on July 28, 2024

➤ Sergey Nikolaev commented:

Can you elaborate on your use case? Why is it important to have it on the client initialization phase?

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

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

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

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".

here you need to enter a field and do sorting

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 ?

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

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:

  1. BSN / Sуnta-6 and Isolate / (protein category)
  2. 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?

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

I don’t understand yet how to put weights at the fields correctly

Here's how it can be done via SQL:

MySQL [(none)]> create table t(field1 text, field2 text, field3 text, field4 text);
MySQL [(none)]> insert into t(field1, field2, field3) values('BSN','Snta-6 and Isolate','protein'),('Bombbar','protein cookies','cookies');
MySQL [(none)]> select * from t where match('protein');
+---------------------+---------+--------------------+---------+--------+
| id                  | field1  | field2             | field3  | field4 |
+---------------------+---------+--------------------+---------+--------+
| 1657913280053641218 | BSN     | Snta-6 and Isolate | protein |        |
| 1657913280053641219 | Bombbar | protein cookies    | cookies |        |
+---------------------+---------+--------------------+---------+--------+
MySQL [(none)]> select * from t where match('protein') option field_weights=(field2=10,field3=1);
+---------------------+---------+--------------------+---------+--------+
| id                  | field1  | field2             | field3  | field4 |
+---------------------+---------+--------------------+---------+--------+
| 1657913280053641219 | Bombbar | protein cookies    | cookies |        |
| 1657913280053641218 | BSN     | Snta-6 and Isolate | protein |        |
+---------------------+---------+--------------------+---------+--------+

The functionality option field_weights is not available in the new php client, so the only way now to execute the above is by using the sql method

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

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?

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

Is there any hope of future API support in the new client?

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.

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

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 ?

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

and now i need FACET

@skvarovski Hi. Is https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#facet not working for you?

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

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 ?

from manticoresearch-php.

skvarovski avatar skvarovski commented on July 28, 2024

my temporary solution for use Field_Ranking and FACET is sphinx client (yii2-sphinx)... its work for multiple result (data & facet)

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

may be i can send raw sql ?

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.

from manticoresearch-php.

sanikolaev avatar sanikolaev commented on July 28, 2024

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.

from manticoresearch-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.