Amazon-Cloudsearch [SOLVED]: How to prioritize complete sentences instead of single search terms?

Amazon-Cloudsearch [SOLVED]: How to prioritize complete sentences instead of single search terms?

Home Forums Amazon Web Services Amazon CloudSearch Amazon-Cloudsearch [SOLVED]: How to prioritize complete sentences instead of single search terms?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #205327

    Cloudy Point
    Keymaster

    QuestionQuestion

    In my CloudSearch instance I want to give a greater priority to complete phrases instead of just word counts.

    An example would be, when I search for “foo bar” I would like documents that have “foo” and “bar” next to each other be scored better than documents that have the two terms scatterred in the document. Of course, any other document containing either words should retrieved but not scored as highly.

    Any ideas of how the query could be done ?

    #205328

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    $searchQuery = array(
      'query' => "(or ".$searchParam." (phrase boost=10 ".$searchParam."))",
      'queryParser' => 'structured',
      'queryOptions' => json_encode(array('defaultOperator' => 'or'))
    );
    

    This worked to some extend.
    Totally random boosting value.

    Source: https://stackoverflow.com/questions/46562210/how-to-prioritize-complete-sentences-instead-of-single-search-terms
    Author: Nick
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.