How can we boost the search if input contains some list of keywords

Hi All,
Hope you are doing well.
We’ve a query on boosting.
How can we boost the search if input contains some list of keywords?

For Eg : I’ve a few keywords like Good, Country

  1. When we search for input “Good Morning”, Since it contains Keyword ‘Good’ in my input then it needs to be given more priority than Morning and display results accordingly(More Boosting to the Good & Less boosting to the Morning).

  2. When we search for input “What is Country of citizenship”, Since it contains keyword ‘Country’ in my input then it needs to be given more priority than other keywords in input and display results accordingly(More Boosting to the Country & Less boosting to the What, is, of, citizenship).

Do we have any scenario where we can achieve the above?
we’ve tried following but didn’t get improved results.

→ Good^1000 Morning
→ What is Country^1000 of citizenship
→ ‘Good’ Morning
→ What is ‘Country’ of citizenship

Thanks & Regards,
Nageswar.

For example,

→ Good^1000 Morning

I think it will work. Could you explain the problem in detail?

Hi @shinsuke,
We are performing searching for following.
1) Altivar 320 installation guide
2) Altivar^1000 320 installation guide

Please find the first 40 documents result count in response for all the search keywords,
In 1st Scenario, Altivar - 236, 320 → 228, installation → 34 and Guide → 48
In 2nd Scenario, Altivar - 210, 320 → 203, installation → 38 and Guide → 59

Actually, In 2nd scenario the count of Altivar should occur more, Correct?
But that’s not happening.

Note : We are not able to attach the request & responses for above scenarios which is in JSON format, Do we have any other way to attach/send those files?

The boost value affects a score to sort them, and the score is calculated by BM25-based algorithm.
So, since words have each weight, I think counting words is meaningless.

Please find the attachments for references.
We are searching for

  1. Install Guide Modicon^10000
  2. Install Guide Modicon

Since we have used boosting character for Modicon keyword then the search results with Modicon should be come first in results, But if you look at attachments that is not happening and observed same behavior with or with out using Boosting character(^).

→ In 2nd, 3rd and 5th occurrence we have a results where there is no Modicon keyword in it, Instead it showing another results which contains other keywords(Install, Guide) even the boost applied for Modicon keyword.

This our issue.

You can get a query dsl from fess.log with a debug level and send it to Elasticsearch/OpenSearch as an explain query directly to check scores.

Hi @shinsuke ,
We’ve done the same thing previously as well by capturing the logs from fess.log and executed at Open Search Dashboard to see the scores and it’s not boosting when using Boosting character(^).

FYI, please find attachments when we use the explain API and compute the score with & with out boosting character for the field title, We got the same score in both the scenarios.

Note : Here we took simple query as we are able to capture it in image and share, The actual running query is pretty big and not able to share it as attachments only support images but not any document files such as in JSON format, Please let us know if there is any way where we could share the request & response JSON files over email etc.

We could not reproduce your problem in our environment.
What is the difference between queries Fess created?
You can remove an aggregation block from the query and focus on a query block in the query DSL.

Hi @shinsuke,
We didn’t get your questions.
What do you mean by

  1. Difference between queries Fess created?
  2. Can remove an aggregation block from the query and focus on a query block in the query DSL

Can you please elaborate these points?

Coming to the issue, We don’t see any improvement in using Boosting symbol(^), As provided multiple examples at above discussion thread, The score and results are pretty similar in both the cases(With & With out using Boosting Symbol).

In Simple scenario we’ve taken Install Guide Modicon example, But it didn’t given desired result when using Boosting symbol.

In Above explain API, Why would it shows same score in both the scenarios when attribute/field called title contains the search keyword with & with out Boosting Symbol?

You can find “Query DSL: {…}” in fess.log with a debug level.
So, you can check if the boost value you specified exists in the query DSL.

Yes, We’ve validated the same already, Before initiating this discussion itself we capture the Query DSL from fess.log and executed the same in Open Search Dashboard, We could see Boost value in the logs(Install Guide Modicon^10000, Don’t see any difference between using & not using boost value).

It’s big query which contains about 1700 lines, So attaching first few lines of query in the previous and current image.

Fess uses a match_phrase query, but your query is a multi_match query.
It’s better to check your search words sent to Fess on your UI.

We are getting error when we use match_phrase instead of multi_match, Looks like match_phrase is not able to apply on multiple fields like multi_match

Did you modify Fess? I do not think Fess creates the query. If you need more support for changing Fess, it’s better to ask Commercial Support.