: I'm using Solr 6.6.0 i have set mm as 100% but when i have the repeated
: search term then mm param is not honoured

: I have 2 docs in index
: Doc1-
: name=lock
: Doc 2-
: name=lock lock
: 
: Now when i'm quering the solr with query
: 
*http://localhost:8983/solr/test2/select?defType=dismax&qf=name&indent=on&mm=100%25&q=lock%20lock&wt=json

: then it is returning both results but it should return only Doc 2 as no of
: frequency is 2 in query while doc1 has frequency of 1 (lock term frequency).

There's a couple of misconceptions here...

first off: "mm" is a property of the "BooleanQuery" object that contains 
multiple SHOULD clauses -- it has nothign to do with the "frequency" of 
any clause/term -- if your BooleanQuery contains 2 SHOULD clauses, then 
the mm=2 will require that both clauses match.  If the 2 clauses are 
*identical* then BooleanQuery will actally optimize away one instance, and 
reduce the mm=1

second: even if BooleanQuery didn't have that optimization -- which was 
the case until ~6.x -- then your original query would *still* match Doc#1, 
because each clause (aka sub-query) would be evaluated independently.  the 
BooleanQuery would ask clause #1 "do you match doc#1?" and it would say 
"yes" -- then the BooleanQuery owuld ask clause #2 "do you match doc#1" 
and it would also say "yes" and so the BooleanQuery would say "i've 
reached the minimum number of SHOULD clauses i was configured to require 
for a match, so doc#1 is a match"


If you have a special case situation of wanting to require that term 
occurs at least X times -- the only way i can think of off the top of my 
head to do that would be using the termfreq() function.  

something like...

        q={!frange l=}termfreq(text,'lock')

https://lucene.apache.org/solr/guide/function-queries.html#termfreq-function
https://lucene.apache.org/solr/guide/other-parsers.html#function-range-query-parser


But i caution that while this might work in the specific example you gave, 
it's not really a drop in replacement for how you _thought_ mm should 
work, so a lot of things you might be trying to do with dismax+mm aren't 
going to have any sort of corollary here.

In general i'm curious as to your broader picture goal, nad if there isn't 
some better solution...


https://people.apache.org/~hossman/#xyproblem
XY Problem

Your question appears to be an "XY Problem" ... that is: you are dealing
with "X", you are assuming "Y" will help you, and you are asking about "Y"
without giving more details about the "X" so that we can understand the
full issue.  Perhaps the best solution doesn't involve "Y" at all?
See Also: http://www.perlmonks.org/index.pl?node_id=542341




-Hoss
http://www.lucidworks.com/

Reply via email to