Boosting Score of Search Results

When end users search for content, the listing of search results is based on the score of a match. A match with the highest score is displayed at the top of the search-results list. PeopleSoft Search Framework allows application designers to programmatically boost the score of a result so that the most relevant results are displayed.

Note: Score boosting cannot be configured on Global and Component searches; only custom searches can be configured with score boosting.

PeopleSoft Search Framework uses the SearchFilterGenerator API to generate custom boosting queries where you provide the boost factor for a filter. The search engine supports score boosting on an individual filter level or on a group of filters and it supports boosting on any filters supported by the SearchFilterGenerator API.

Note: PeopleSoft Search Framework restricts the use of multiple score functions such as ADD, MIN, MAX, etc. within a single query. Only one operation is allowed in a single request.

The following code sample generates a custom score based on a filter on product for values of television, TV, monitor, or display with a boost factor.

If &fg.MatchAnyReturnTrue() Then
   &fg.ContainsWord("PRODUCT" ,"Television");
   &fg.BoostFilterScore(0.03);
   &fg.ContainsWord("PRODUCT" ,"TV");
   &fg.BoostFilterScore(0.03);
   &fg.ContainsWord("PRODUCT" ," Monitor");
   &fg.BoostFilterScore(0.02);
   &fg.ContainsWord("PRODUCT" ,"Display");
   &fg.EndMatchAny();
   &fg.setBoostModeSum();
End-If;

For code examples of custom score boosting, see Search Filter Generator Examples.

Note: Faceted navigation is supported in Elasticsearch.

Sample Custom Queries for Score Boosting

Applying a single filter:

If &fg.MatchAllReturnTrue() Then
   &fg.ContainsWord("DEPTNAME", "support");
   &fg.BoostFilterScore(0.02);
   &fg.EndMatchAll();
End-If;

Joining filters with logical operators:

If &fg.MatchAllReturnTrue() Then
   &fg.ContainsWord("DEPTNAME", "support");
   &fg.BoostFilterScore(0.02);
   &fg.ContainsWord("QE_STATUS", "open");
   &fg.BoostFilterScore(0.03);
   &fg.EndMatchAll();
End-If;

Applying individual scores in a function such as ADD, AVG, etc. to get overall score on the document based on filter matches:

If &fg.MatchAnyReturnTrue() Then
   &fg.ContainsWord("DEPTNAME", "support");
   &fg.BoostFilterScore(0.02);
   &fg.ContainsWord("QE_STATUS", "open");
   &fg.BoostFilterScore(0.03);
   &fg.EndMatchAny();
   &fg.setBoostModeSum(); 
End-If;

Using wild cards (use * and ? for multi character and single character match respectively):

If &fg.MatchAllReturnTrue() Then
   &fg.ContainsWord("MESSAGE_TEXT", "l*g");
   &fg.BoostFilterScore(0.01);
   &fg.ContainsWord("MESSAGE_TEXT", "b??ght");
   &fg.BoostFilterScore(0.02);
   &fg.EndMatchAll();
End-If;

Using stemming (add '$' in front of the word to consider it for stemming):

If &fg.MatchAllReturnTrue() Then
   &fg.ContainsWord("MESSAGE_TEXT", "$wanted");
   &fg.BoostFilterScore(0.03);
   &fg.EndMatchAll();
End-If;

Using score boosting without specifying a field:

If &fg.MatchAnyReturnTrue() Then
   &fg.ContainsWord("","long");
   &fg.BoostFilterScore(0.02);
   &fg.EndMatchAny();
End-If;

Using Fuzzy search (use ~ at the end of the word to treat it as fuzzy search request):

If &fg.MatchAnyReturnTrue() Then
   &fg.ContainsWord("MESSAGE_TEXT", "speeks~");
   &fg.BoostFilterScore(0.02);
   &fg.EndMatchAny();
End-If;

The Search Test Page allows you to check the score boosting feature.

See Using the Search Test Page.