We have gone back and forth a bit to accommodate a couple of ways in which people wanted the weights to behave in cross-field matching.
Let me first explain how Typesense handles multi-field text match ranking in the default mode.
- For a given record, we compute a text match score for every field based on how much that field value overlaps with the query tokens. We consider number of overlapping tokens, number of typos etc. to arrive at a per-field score.
- Let's say we are querying 2 fields (brand, name in this this case). This will result in text match scores A and B respectively. The highest text match score among the fields becomes the representative score for this record.
- When we rank all the records, this representative score is first checked. The field weight only acts as a tie-breaker when 2 records have have the same representative text match score.
Some people wanted this behavior because in many other cases absolute degree of text match mattered more than the weight. To accomodate the behavior you desire here, we've intrduced a flag. Send "?text_match_type=max_weight" parameter in the search requests.