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

Include Boost in Orckestra.Search.WebsiteSearch.SearchResultEntry.FieldValues #790

Open
slacto opened this issue Dec 10, 2021 · 5 comments
Assignees

Comments

@slacto
Copy link

slacto commented Dec 10, 2021

I'm working with the new Boost value in SearchDocumentBuilder and I have created a ISearchDocumentBuilderExtension to boost recently added pages.
I would like to have the Boost value in my search result. Like in Orckestra.Search.WebsiteSearch.SearchResultEntry.FieldValues.
Can you add Score before boost and the Boost value in all search packages?
It will be easier to explain to the customer if they can see the scores.

@napernik
Copy link
Contributor

Hi Søren

The original value of index-time Boost property isn't preserved by the Lucene, so you may have to add a custom field to return it. If you calculate it as a formula based on when the document was indexed and some field values, you can run the formula dynamically to show in the results.

When it comes to scoring, it might be possible to add. I'm currently on a sick leave, when I'm back I'll try to do some debugging to see if Scoring information is available and can be exposed.

@napernik napernik self-assigned this Jan 19, 2022
@napernik
Copy link
Contributor

While Boost is seemingly not preserved, returning score should be doable:

image

It will be easier to explain to the customer if they can see the scores.

In Lucene there's already an option to include "explanation" into the search results.
It might be more useful than just showing Scope and Boost:

browseRequest.ShowExplanation = true;

gives me the following results:

image

{3.923689 = (MATCH) sum of:
  3.600704 = (MATCH) weight(label:test^2.0 in 20), product of:
    0.9208084 = queryWeight(label:test^2.0), product of:
      2 = boost
      3.910372 = idf(docFreq=10, maxDocs=202)
      0.1177392 = queryNorm
    3.910372 = (MATCH) fieldWeight(label:test in 20), product of:
      1 = tf(termFreq(label:test)=1)
      3.910372 = idf(docFreq=10, maxDocs=202)
      1 = fieldNorm(field=label, doc=20)
  0.3229849 = (MATCH) weight(fulltext:test in 20), product of:
    0.3900153 = queryWeight(fulltext:test), product of:
      3.312536 = idf(docFreq=19, maxDocs=202)
      0.1177392 = queryNorm
    0.8281339 = (MATCH) fieldWeight(fulltext:test in 20), product of:
      1 = tf(termFreq(fulltext:test)=1)
      3.312536 = idf(docFreq=19, maxDocs=202)
      0.25 = fieldNorm(field=fulltext, doc=20)
}

I think we can always return the Score, and calculate the Explanation when needed.

I'm not 100% sure if we will have it in the next release, you can try adapting the source code for the package, which is located here:

https://github.com/Orckestra/CMS-Packages-Search

@slacto
Copy link
Author

slacto commented Feb 24, 2022 via email

@napernik
Copy link
Contributor

napernik commented Apr 4, 2022

An update: Orckestra.Search.LuceneNET version 1.2.1 was published

Orckestra/CMS-Packages-Search@81da1d2

@napernik
Copy link
Contributor

Can a new attribute ShowExplanation be part of WebsiteSearchQuery in https://github.com/Orckestra/CMS-Packages/blob/master/Orckestra.Search.WebsiteSearch/Orckestra.Search.WebsiteSearch/WebsiteSearchFacade.cs#L43? So I can request it like https://www.lpb.dk/SearchResults?q=pension https://www.lpb.dk/SearchResults?q=pension&explanation=true &explanation=true.

@slacto If you make a PR for the Orckestra.Search.WebsiteSearch, we'll merge it.
The conditions could be
a) having a C1 console user logged in
and
b) "explanation=true" in request URL

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