1

supposedly I have 4 words (let's call them a,b,candd for sake of example) and I want to search in solr to match 3 of these. I could write a query with all the permutations as follows:

(a AND b AND c)OR(a AND b AND d)OR(b AND c and d)

This will work and matches documents with 3 of these 4 words.

but things get messy when I have 10 words and need to match 3 of them. The number of permutations required grows exponentially.

obviously thanks to the complexity of the query solr goes busted(it gets too slow to respond)

I've searched all over internet to find out if there is a special command I could use for something like this. I couldn't find anything. I'm just wondering if there is any tricks that could be done to accomplish something like this.

nafas
  • 5,283
  • 3
  • 29
  • 57
  • you want to match exactly 3 words out of 4? – Mysterion Feb 18 '15 at 09:28
  • 1
    @Mysterion that was just an example, what I want to do is to match k out of n words. I want to say return me documents that have at least k of the n words – nafas Feb 18 '15 at 15:02

1 Answers1

2

Have a look at the mm parameter of the eDisMax parser.

Evan Haas
  • 2,524
  • 2
  • 22
  • 34
  • I think that is exactly what I'm looking for mate, I will get the answer as accepted as soon as I figure out how to use the mm parameter (correctly) – nafas Feb 18 '15 at 15:06
  • thanks again mate, it was easier than expected. the only thing is that mm must be used along side defType=edismax or defType=dismax to work correctly. – nafas Feb 18 '15 at 15:15