Hi Im trying to build a query in c# using solr:
Query.Append($"&fq={{frange l=3}}termfreq(Description,'keyword') OR {{frange l=1}}termfreq(title, 'keyword'")"
While this one below works :
Query.Append($"&fq={{frange l=3}}termfreq(Description,'keyword')")
The occurrence should be 3 times in the description OR 1 time in title. But executing the query gives a syntax error. Using termfreq once works but with conditions, it's failing.
Any help? Thanks.
You can solve this by collapsing it into one single frange:
This will give you 3 as a value if it's three times in Description, or if it's at least once in Title (being the sum of occurences of
keywordin Description and occurences ofkeywordin Title - multiplied by three. So if it occurs once in the title, you get1 * 3 => 3, but for the description field you don't multiply at all - meaning you'll have to have it occur three times to get to three.