lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <j...@basetechnology.com>
Subject Re: LIMIT on number of OR in fq
Date Sun, 09 Jun 2013 17:34:04 GMT
Maybe it is hitting some kind of container limit on URL length, like more 
than 2048?

Add &debugQuery=true to your query and see what query is both received and 
parsed and generated.

Also, if the default query operator is set to or, fq={! q.op=OR}..., then 
you can drop the " OR " operators for a shorter query string.

That said, as with most features of Lucene and Solr, the #1 rule is: Use 
them in moderation. A few dozen IDs are fine. A hundred immediately raising 
suspicion - what are you really trying to do? 200?! 250??!! Over 300?!! 
1,000?!?! 5,000?!?! I mean, do you really need to do all of this on a single 
"query"? If you find yourself saying "Yes", go back to the drawing board and 
think a lot more carefully what your data model is. I mean, the application 
data model is supposed to simplify queries. Your case does not seem simple 
at all.

Tell us what you are really trying to do with this extreme filter query. The 
fact that you stumbled into an apparent problem should just be a wakeup call 
that you need to reconsider your basic design assumptions.

-- Jack Krupansky

-----Original Message----- 
From: Kamal Palei
Sent: Sunday, June 09, 2013 9:07 AM
To: solr-user@lucene.apache.org
Subject: LIMIT on number of OR in fq

Dear All
I am using below syntax to check for a particular field.
&fq=locations:(5000 OR 10000 OR 15000 OR 20000 OR 75100)
With this I get the expected result properly.

In a particular situations the number of ORs are more (looks around 280)
something as below.

&fq=pref_work_locations:(5000 OR 10000 OR 15000 OR 20000 OR 75100 OR 125300
OR 25300 OR 141100 OR 100700 OR 50300 OR 132100 OR 25000 OR 25100 OR 25200
OR 25400 OR 25500 OR 25600 OR 25700 OR 25800 OR 25900 OR 26000 OR 26100 OR
26200 OR 26300 OR 26400 OR 26500 OR 30000 OR 30100 OR 35000 OR 35100 OR
35200 OR 35300 OR 35400 OR 35500 OR 35600 OR 35700 OR 35800 OR 40000 OR
45000 OR 45100 OR 45200 OR 45300 OR 45400 OR 45500 OR 50000 OR 50100 OR
50200 OR 55000 OR 55100 OR 55200 OR 55300 OR 55400 OR 55500 OR 55600 OR
55700 OR 60000 OR 60100 OR 60200 OR 60300 OR 60400 OR 60500 OR 65000 OR
65100 OR 65200 OR 70000 OR 70100 OR 70200 OR 70300 OR 70400 OR 75000 OR
75200 OR 75300 OR 75400 OR 75500 OR 75600 OR 75700 OR 75800 OR 75900 OR
76000 OR 76100 OR 76200 OR 76300 OR 76400 OR 80000 OR 80100 OR 80200 OR
80300 OR 80400 OR 80500 OR 85000 OR 85100 OR 85200 OR 85300 OR 85400 OR
85500 OR 85600 OR 85700 OR 85800 OR 85900 OR 86000 OR 86100 OR 86200 OR
90000 OR 90100 OR 90200 OR 90300 OR 90400 OR 90500 OR 90600 OR 90700 OR
90800 OR 90900 OR 91000 OR 91100 OR 91200 OR 91300 OR 91400 OR 91500 OR
91600 OR 91700 OR 91800 OR 91900 OR 92000 OR 92100 OR 92200 OR 92300 OR
92400 OR 92500 OR 92600 OR 92700 OR 92800 OR 92900 OR 95000 OR 95100 OR
100000 OR 100100 OR 105000 OR 105100 OR 105200 OR 105300 OR 105400 OR
105500 OR 105600 OR 105700 OR 105800 OR 105900 OR 106000 OR 106100 OR
106200 OR 110000 OR 110100 OR 115000 OR 115100 OR 115200 OR 115300 OR
115400 OR 115500 OR 120000 OR 120100 OR 120200 OR 120300 OR 120400 OR
120500 OR 120600 OR 120700 OR 120800 OR 120900 OR 121000 OR 121100 OR
125000 OR 125100 OR 125200 OR 125400 OR 125500 OR 125600 OR 125700 OR
125800 OR 125900 OR 126000 OR 126100 OR 130000 OR 130100 OR 130200 OR
130300 OR 130400 OR 130500 OR 130600 OR 130700 OR 130800 OR 130900 OR
131000 OR 131100 OR 131200 OR 131300 OR 131400 OR 131500 OR 131600 OR
131700 OR 131800 OR 131900 OR 132000 OR 132200 OR 132300 OR 132400 OR
132500 OR 135000 OR 135100 OR 140000 OR 140100 OR 140200 OR 140300 OR
140400 OR 140500 OR 140600 OR 140700 OR 140800 OR 140900 OR 141000 OR
141200 OR 141300 OR 141400 OR 141500 OR 141600 OR 141700 OR 141800 OR
141900 OR 142000 OR 142100 OR 145000 OR 150000 OR 155000 OR 160000 OR
165000 OR 170000 OR 175000 OR 180000 OR 185000 OR 190000 OR 195000 OR
200000 OR 205000 OR 210000 OR 215000 OR 220000 OR 225000 OR 230000 OR
235000 OR 240000 OR 245000 OR 250000 OR 255000 OR 260000 OR 265000 OR
270000 OR 275000 OR 280000 OR 285000 OR 290000 OR 295000 OR 300000 OR
305000 OR 310000 OR 315000 OR 320000 OR 325000 OR 330000 OR 335000 OR
340000 OR 345000 OR 350000 OR 355000 OR 360000 OR 365000 OR 370000 OR
375000 OR 380000 OR 385000 OR 390000)


When we have such a high number of ORs, it gives me 0 records, whereas I
expected all possible records.

So I am wondering, is there any limit for ORs in one fq filter.

I know I need to go for something like, &fq=locations:[min , max] format,
but that may not be possible always.., or probably we need to modify a
bigger piece of code. So just as a temporary solution, is there anyother
way I can follow?

Best Regards
Kamal 


Mime
View raw message