Loading TOC...

MarkLogic 12 EA 2 Product Documentation
cts.boostQuery

cts.boostQuery(
   matching-query as cts.query,
   boosting-query as cts.query
) as cts.boostQuery

Summary

Returns a query specifying that matches to $matching-query should have their search relevance scores boosted if they also match $boosting-query.

Parameters
matching-query A sub-query that is used for match and scoring.
boosting-query A sub-query that is used only for boosting score.

Usage Notes

When used in a search, $boosting-query is not evaluated if there are no matches to $matching-query.

When used in a search, all matches to $matching-query are included in the search results. $boosting-query only contributes to search relevances scores. Scoring is done the same way as for a cts.andQuery.

See Also

Example

fn.subsequence(
 cts.search(
  cts.boostQuery(
      cts.wordQuery('George'),
      cts.wordQuery('Washington', null, 10.0)
  )), 1, 10)

// Result: The first 10 documents containing the word "George". Those 
// documents that also contain the word "Washington" have a higher relevance
// score than those elements that do not.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.