Hi Daniel,

index the id into a field of type tint or tlong and use a range query 
(http://wiki.apache.org/solr/SolrQuerySyntax?highlight=%28rangequery%29):

fq=id:[200 TO 2000]

If you want to exclude certain ids it might be wiser to simply add an exclusion 
query in addition to the range query instead of listing all the single values. 
You will run into problems with too long request urls. If you cannot avoid long 
urls you might want to increase maxBooleanClauses (see 
http://wiki.apache.org/solr/SolrConfigXml/#The_Query_Section).

Cheers,
Chantal

Am 26.07.2012 um 18:01 schrieb Daniel Brügge:

> Hi,
> 
> i am facing the following issue:
> 
> I have couple of million documents, which have a field called "source_id".
> My problem is, that I want to retrieve all the documents which have a
> source_id
> in a specific range of values. This range can be pretty big, so for example
> a
> list of 200 to 2000 source ids.
> 
> I was thinking that a filter query can be used like fq=source_id:(1 2 3 4 5
> 6 .....)
> but this reminds me of SQLs WHERE IN (...) which was always bit slow for a
> huge
> number of values.
> 
> Another solution that came into my mind was to assigned all the documents I
> want to
> retrieve a new kind of "filter id". So all the documents which i want to
> analyse
> get a new id. But i need to update all the millions of documents for this
> and assign
> them a new id. This could take some time.
> 
> Do you can think of a nicer way to solve this issue?
> 
> Regards & greetings
> 
> Daniel

Reply via email to