문제

  1. Suppose a user enters a two word input for search, since the default boolean applied is OR, all entries containing all or both entries appear. What I was interested to know, is that if conditions specifically meeting the AND condition could be boosted.
  2. In case of multiple words, can words be specified to imply specific constraints in searching or boost few parameters in case these words are present.For e.g: , if input be "with x and y without z", can i make my solr to interpret it as (x AND y) AND (Not z)? or at least boost those entries which partially or fully meet the requirement?

EDIT: I have tried using boost with edismax as shown here:

$query = $client->createSelect();                                   //create search query
        $query->setQuery('memberType:'.$searchQuery.' firstName:'.$searchQuery.' gender:'.$searchQuery); //include fields required for searching                         //meantion fields to be searched and search query/ies
        $edismax = $query->getEDisMax();
        $edismax->setQueryFields('firstName memberType^3 gender^2');                            //boost fields
        $query->setStart($start)->setRows($rows);                           //vary bracketted numbers to vary results staring point and no. of rows to be displayed, use variables instead of constants
        $query->setFields(array('id', 'firstName', 'lastName', 'eid', 'gender', 'memberType'));  //set return fields
        //$query->addSort('id', $query::SORT_ASC);                //sort field and customisations

        $resultSet = $client->select($query); 

When i search for a name with a particular member type, like "sanjay candidate" i expect the order to be entries with sanjay and candidate, and then all users who are candidates and then all users who are sanjay, but instead i get sanjay and candidate then all who are sanjay and then all candidates.

I am not able to figure out what the issue may be or if i can provide a more customized boosting.

도움이 되었습니까?

해결책

If you are using eDismax, you have a whole collection of boosting options for a phrase, bigram, a separate boosting query and so on. Reading through the wiki page and experiment. You should not need to do any custom coding for this scenario.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top