# Full-text search query settings¶

Prototype: function SetFieldWeights ( $weights ) Binds per-field weights by name. Parameter must be a hash (associative array) mapping string field names to integer weights. Match ranking can be affected by per-field weights. For instance, see Search results ranking for an explanation how phrase proximity ranking is affected. This call lets you specify what non-default weights to assign to different full-text fields. The weights must be positive 32-bit integers. The final weight will be a 32-bit integer too. Default weight value is 1. Unknown field names will be silently ignored. There is no enforced limit on the maximum weight value at the moment. However, beware that if you set it too high you can start hitting 32-bit wraparound issues. For instance, if you set a weight of 10,000,000 and search in extended mode, then maximum possible weight will be equal to 10 million (your weight) by 1 thousand (internal BM25 scaling factor, see search_results_ranking) by 1 or more (phrase proximity rank). The result is at least 10 billion that does not fit in 32 bits and will be wrapped around, producing unexpected results. ## SetIndexWeights¶ Prototype: function SetIndexWeights ($weights )

Sets per-index weights, and enables weighted summing of match weights across different indexes. Parameter must be a hash (associative array) mapping string index names to integer weights. Default is empty array that means to disable weighting summing.

When a match with the same document ID is found in several different local indexes, by default Manticore simply chooses the match from the index specified last in the query. This is to support searching through partially overlapping index partitions.

However in some cases the indexes are not just partitions, and you might want to sum the weights across the indexes instead of picking one. SetIndexWeights() lets you do that. With summing enabled, final match weight in result set will be computed as a sum of match weight coming from the given index multiplied by respective per-index weight specified in this call. Ie. if the document 123 is found in index A with the weight of 2, and also in index B with the weight of 3, and you called SetIndexWeights ( array ( "A"=>100, "B"=>10 ) ), the final weight return to the client will be 2100+310 = 230.

## SetMatchMode¶

DEPRECATED

Prototype: function SetMatchMode ( $mode ) Sets full-text query matching mode, as described in Matching modes. Parameter must be a constant specifying one of the known modes. WARNING: (PHP specific) you must not take the matching mode constant name in quotes, that syntax specifies a string and is incorrect:$cl->SetMatchMode ( "SPH_MATCH_ANY" ); // INCORRECT! will not work as expected

## SetSortMode¶

Prototype: function SetSortMode ( $mode,$sortby=“” )

Set matches sorting mode, as described in Sorting modes. Parameter must be a constant specifying one of the known modes.

WARNING: (PHP specific) you must not take the matching mode constant name in quotes, that syntax specifies a string and is incorrect:

$cl->SetSortMode ( "SPH_SORT_ATTR_DESC" ); // INCORRECT! will not work as expected$cl->SetSortMode ( SPH_SORT_ATTR_ASC ); // correct, works OK

## SetWeights¶

Prototype: function SetWeights ( \$weights )

Binds per-field weights in the order of appearance in the index. DEPRECATED, use SetFieldWeights() instead.