lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amin Mohammed-Coleman <ami...@gmail.com>
Subject Re: TermRangeQuery
Date Fri, 26 Nov 2010 22:01:57 GMT
Essentially I'd like to construct a query which is almost like SQL in clause.  The lucene document
contains the id and a string value. I'd like to get the string value based on the id key.
 The ids may range within 1000. Is this possible to do?

Thanks
Amin

Sent from my iPhone

On 26 Nov 2010, at 20:18, Ian Lea <ian.lea@gmail.com> wrote:

> What sort of ranges are you trying to use?  Maybe you could store a
> separate field, just for these queries, with some normalized form of
> the ids, with all numbers padded out to the same length etc.
> 
> --
> Ian.
> 
> On Fri, Nov 26, 2010 at 4:34 PM, Amin Mohammed-Coleman <aminmc@gmail.com> wrote:
>> Hi
>> 
>> Unfortunately my range query approach did not work.   It seems to be related to the
ids themselves.  The list has ids that look this:
>> 
>> 
>> ID-NYC-1234
>> ID-LND-1234
>> TX-NYC-1334
>> TX-NYC-BBC-123
>> 
>> The ids may range from 90 to 1000.  Is there another approach I could take?  I tried
building a string with all the ids and set them against a field for example:
>> 
>> dataId: ID-NYC-123 dataId: ID-NYC-1234....
>> 
>> but that's not a great approach I know...
>> 
>> any help would be appreciated.
>> 
>> Thanks
>> Amin
>> 
>> 
>> 
>> On 26 Nov 2010, at 14:39, Ian Lea wrote:
>> 
>>> Absolutely, as long as your ids will sort as you expect.
>>> 
>>> I'm not clear what you mean by XDF-123 but if you've got
>>> 
>>> AAA-123
>>> AAA-124
>>> ...
>>> ABC-123
>>> ABC-234
>>> etc.
>>> 
>>> then you'll be fine.  If they don't sort so neatly you can use the
>>> TermRangeQuery constructor that takes a Collator but note the
>>> performance warning in the javadocs.
>>> 
>>> 
>>> --
>>> Ian.
>>> 
>>> 
>>> On Fri, Nov 26, 2010 at 2:18 PM, Amin Mohammed-Coleman <aminmc@gmail.com>
wrote:
>>>> Hi All
>>>> 
>>>> I was wondering whether I can use TermRangeQuery for my use case.  I have
a collection of ids (represented as XDF-123) and I would like to do a search for all the ids
(might be in the range of 10000) and for each matching id I want to get the corresponding
data that is stored in the index (for example the document contains id and string value).
 I am using a custom collector to collect that string value for each match.  Is it ok to use
a TermRangeQuery for the ids rather than creating a massive query string?
>>>> 
>>>> 
>>>> Thanks
>>>> Amin
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message