blevesearch / bleve

A modern text/numeric/geo-spatial/vector indexing library for go
Apache License 2.0
10k stars 678 forks source link

How to ignore fieldNorm for some fields #1039

Open horsley opened 5 years ago

horsley commented 5 years ago

For example. two document

doc 1 : {name: "XXX", alias: ["a", "b", "c"]}
doc 2 : {name: "YYY", alias: ["a", "d"]}

In my business I hope that I search alias and the score was equal for this two doc. They have the same TF and IDF, but fieldNorm was different since the fieldLength(terms count) was different. In my case, the terms in this field were synonyms. The number of terms in this field should be ignore when calculate score, so I can sort the result by score, then the name field. If I sort by name field first, the order result became irrelevant totally, that's bad.

horsley commented 5 years ago

fieldNorm was caculated in upsidedown.go. Maybe we can add a field option, configurable via field mapping, for fieldNorm behavior control