Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

comparing index fields within a query

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


jamie at stimulussoft

Jan 23, 2012, 2:33 AM

Post #1 of 5 (310 views)
Permalink
comparing index fields within a query

Hi Everyone

I have a problem where I need to compare two indexed fields as part of a
query.

For instance: modified_date[1970 to 2012] AND NOT deleted_date>modified_date

how would one implement this using Lucene?

Bear in mind, I need a dynamic way of accomplishing this comparison.

In my case, it is not possible to store the result of
deleted_date>modified_date at the time of indexing.

Thanks

Jamie

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


ian.lea at gmail

Jan 23, 2012, 4:21 AM

Post #2 of 5 (290 views)
Permalink
Re: comparing index fields within a query [In reply to]

I guess you could do it in a custom Collector. They get passed
readers and docids so you could do the lookups and comparison. There
will be performance implications that you may be able to minimise via
FieldCache.

Storing the result in the index sounds much more sensible.


--
Ian.


On Mon, Jan 23, 2012 at 10:33 AM, Jamie <jamie [at] stimulussoft> wrote:
> Hi Everyone
>
> I have a problem where I need to compare two indexed fields as part of a
> query.
>
> For instance: modified_date[1970 to 2012] AND NOT deleted_date>modified_date
>
> how would one implement this using Lucene?
>
> Bear in mind, I need a dynamic way of accomplishing this comparison.
>
> In my case, it is not possible to store the result of
> deleted_date>modified_date at the time of indexing.
>
> Thanks
>
> Jamie
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


jamie at stimulussoft

Jan 23, 2012, 4:31 AM

Post #3 of 5 (291 views)
Permalink
Re: comparing index fields within a query [In reply to]

Ian

Thanks. I'll have to read up about it. I have a lot of comparisons to
make, so cannot precompute the values.

Don't you think this would be a nice feature for Lucene?

The Lucene query syntax has not changed much over the past few years.
Are there any plans to broaden its capabilities?

Jamie

On 2012/01/23 2:21 PM, Ian Lea wrote:
> I guess you could do it in a custom Collector. They get passed
> readers and docids so you could do the lookups and comparison. There
> will be performance implications that you may be able to minimise via
> FieldCache.
>
> Storing the result in the index sounds much more sensible.
>
>
> --
> Ian.
>
>
> On Mon, Jan 23, 2012 at 10:33 AM, Jamie<jamie [at] stimulussoft> wrote:
>> Hi Everyone
>>
>> I have a problem where I need to compare two indexed fields as part of a
>> query.
>>
>> For instance: modified_date[1970 to 2012] AND NOT deleted_date>modified_date
>>
>> how would one implement this using Lucene?
>>
>> Bear in mind, I need a dynamic way of accomplishing this comparison.
>>
>> In my case, it is not possible to store the result of
>> deleted_date>modified_date at the time of indexing.
>>
>> Thanks
>>
>> Jamie
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
>> For additional commands, e-mail: java-user-help [at] lucene
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


ian.lea at gmail

Jan 23, 2012, 6:06 AM

Post #4 of 5 (294 views)
Permalink
Re: comparing index fields within a query [In reply to]

> ...
> Don't you think this would be a nice feature for Lucene?

Can't say I've ever missed it, and haven't noticed others asking for
it. You need to remember that lucene is not a database.

> The Lucene query syntax has not changed much over the past few years. Are
> there any plans to broaden its capabilities?

Not that I know of, but I wouldn't really know.


--
Ian.

> On 2012/01/23 2:21 PM, Ian Lea wrote:
>>
>> I guess you could do it in a custom Collector.  They get passed
>> readers and docids so you could do the lookups and comparison.  There
>> will be performance implications that you may be able to minimise via
>> FieldCache.
>>
>> Storing the result in the index sounds much more sensible.
>>
>>
>> --
>> Ian.
>>
>>
>> On Mon, Jan 23, 2012 at 10:33 AM, Jamie<jamie [at] stimulussoft>  wrote:
>>>
>>> Hi Everyone
>>>
>>> I have a problem where I need to compare two indexed fields as part of a
>>> query.
>>>
>>> For instance: modified_date[1970 to 2012] AND NOT
>>> deleted_date>modified_date
>>>
>>> how would one implement this using Lucene?
>>>
>>> Bear in mind, I need a dynamic way of accomplishing this comparison.
>>>
>>> In my case, it is not possible to store the result of
>>> deleted_date>modified_date at the time of indexing.
>>>
>>> Thanks
>>>
>>> Jamie

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


trejkaz at trypticon

Jan 23, 2012, 2:22 PM

Post #5 of 5 (290 views)
Permalink
Re: comparing index fields within a query [In reply to]

On Mon, Jan 23, 2012 at 11:31 PM, Jamie <jamie [at] stimulussoft> wrote:
> Ian
>
> Thanks. I'll have to read up about it. I have a lot of comparisons to make,
> so cannot precompute the values.

How many is a lot? If it were 100 or so I would still be tempted to do
all 4,950 comparisons and find some sensible way to store them. It
would increase the size of each document a little in the index but
it's not like you need to store the values.

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.