Filter by match_phrase, score by phrase frequency

Hi there!

I want to score document relevance by exact phrase frequency in a field. Some queries have multiple phrases for filtering. Is there any better way than scripting a custom score function?

UPD: My experiments with scripted score function and shingles So far scripted solution works best. However I'm unsure about performance impact.


Do you always need to sort by phrase freq? If yes then I think you could just use a regular phrase query on a field that has norms disabled.

jpountz, all the time. Hence why I use similarity provider that returns 1 as IDF.