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

RDoc-2514 Explain Boosting options + Update indexing configuration #1738

Merged

Conversation

Danielle9897
Copy link
Member

@Danielle9897 Danielle9897 commented Jan 17, 2024

Related issues:
https://issues.hibernatingrhinos.com/issue/RDoc-2514/Explain-Boosting-options-when-indexing
https://issues.hibernatingrhinos.com/issue/RDoc-2552/Disable-OrderByScore-when-Boosting-is-involved-Update-indexing-configuration-file
https://issues.hibernatingrhinos.com/issue/RDoc-2332/Add-information-about-supporting-document-boost-in-documentation
https://issues.hibernatingrhinos.com/issue/RDoc-2380/Add-missing-indexing-configuration-keys


Work included:

../indexing-configuration files:
Update the indexing-configuration with all missing keys

../indexes/boosting files:
Explain the 2 ways to apply boosting inside the index definition (on index-field vs index-entry)
Added Javascript index examples + updated Node.js

../sort-query-results files:
Organize "how to get the score" in a single location.

../boost-search-results files:
Explain the configurable option to order-by-score when Boosting is involved - in all relevant places


@ml054 The main Node.js files to check in this PR is:

Documentation/6.0/Raven.Documentation.Pages/indexes/boosting.js.markdown
Documentation/6.0/Samples/nodejs/indexes/boosting.js

@maciejaszyk The main C# files to check:

Documentation/5.4/Raven.Documentation.Pages/server/configuration/indexing-configuration.markdown
Documentation/6.0/Raven.Documentation.Pages/server/configuration/indexing-configuration.markdown
Documentation/6.0/Raven.Documentation.Pages/indexes/boosting.dotnet.markdown
Documentation/6.0/Samples/csharp/Raven.Documentation.Samples/Indexes/Boosting.cs

}`;
}
}
//endregion
Copy link
Member Author

@Danielle9897 Danielle9897 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ml054
My Q was about this index and the one below

Can we use Boost with JS index in Node.js client ?

The only implementation I saw in the tests was with AbstractCsharpIndexCreationTask

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in query yes, in JS index I don't see such feature.

//
// * Unless configured otherwise, the resulting documents will be ordered by their score.
//
// * Search is case-insensitive.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary information I guess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is Not incorrect (as I saw when I ran the above), then I would prefer to leave this info.
For now, just modified the location of this comment to be less noticeable as follows:

        // * Results will contain all Employee documents that have
        //   EITHER 'English' OR 'Italian' in their 'Notes' field (case-insensitive).
        //
        // * Matching documents that contain 'Italian' will get a HIGHER score
        //   than those that contain 'English'.
        //
        // * Unless configured otherwise, the resulting documents will be ordered by their score.  

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant // * Search is case-insensitive. but OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I provide the text about search being case-sensitive is because the text in my comment says the following;

Results will contain all Employee documents that have  EITHER 'English' OR 'Italian' in their 'Notes' field 

my comment specified 'English' OR 'Italian'
but results will also contain documents having 'english' OR 'italian' (in the supplied example)
so that is why I thought to mention that.

{CODE-TAB:csharp:DocumentQuery boost_3@ClientApi\Session\Querying\TextSearch\BoostResults.cs /}
{CODE-TAB-BLOCK:sql:RQL}
from "Employees" where
(search(Notes, "English") or boost(search(Notes, "Italian"), 10))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brackets are not required here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the excess brackets

.ToList();

// Because index-field 'ShipToCountry' was boosted (inside the index definition),
// then documents containing 'Poland' in their 'ShipTo.Country' field will get a higher score than
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove dot from field name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I wrote ShipTo.Country is because at this point the sentence refers to the document-field.

As I understand - the content of index-field ShipToCountry is composed of the content from the document-field ShipTo.Country.

So you boost the index-field, but the resulting documents (in this example) are those that contain the matching value in their document-field

=> So is that incorrect ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have asked because you have index definition with different fieldname but OK.

@@ -0,0 +1,29 @@
# Indexes: Boosting

A feature that RavenDB leverages from Lucene is called Boosting. This feature gives you the ability to manually tune the relevance level of matching documents when performing a query.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use same text as for dotnet version here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I added (just) the text to the Java markdown files
but, it needs to be said that for my current scope of work, as was done for previous PRs,
I do not modify, test, or provide new Java examples, I concentrate on C# and Node.js

If a new C# markdown file needs to be created in 6.0 for example, then the Java files (and other clients files)
must be copied over to the folder, otherwise the language will not be visible at run time.

- **Scope**: Server-wide or per database
- **Default**: `6`
- **Scope**: Server-wide, or per database, or per index
- **Alias:** `Indexing.Lucene.Analyzers.NGram.MaxGram`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered in ticket

@ppekrol ppekrol merged commit 692a167 into ravendb:master Feb 6, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants