lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nader S. Henein" <...@bayt.net>
Subject RE: Sorting
Date Thu, 20 Jun 2002 05:03:32 GMT
I've been working with Lucene for the past three months and we're at t
the final stages before launching with Lucene as our core search engine
(the move was made from oracle internmedia) and sorting was an issue
as we normally pumped out our results ordered by date. As it stands Lucene
produces a resultant set ordered by Score, I believe that with some tweaking
the same logic used to fetch score-orderd results could be applied to other
fields.

I might be a little bit off here, but sorting the results in memory would be
too intensive
and would defeat the purpose as a 12 000 record resultant set would outweigh
the speed provided
by Lucene witch remains one of it's biggest assets, and trust me I tried
Quick Sort ..
Bi-Directional Quick Sort and a slew of other sorting algorithms, too slow
if you want to scale
well.





-----Original Message-----
From: Peter Carlson [mailto:carlson@bookandhammer.com]
Sent: Thursday, June 20, 2002 8:48 AM
To: Lucene Users List
Subject: Re: Sorting


Hi Fanny,

This is a bit tricky because Lucene is optimized to not get the contents of
a given Document until asked. This is a somewhat expensive operation and if
sorting by getting the contents of the field will potentially slow down the
search results dramatically.

There has been some discussion on this and the current idea is to create a
separate array which contains the field contents for every record with an
index of the global documentID. Then when you get the results back, you sort
the results by getting the data from the array (which is already in memory)
instead of from the index.

I have done this already and have moved by contribution to the
Lucene-Sandbox. It is encapsulated into the SearchBean directory

http://cvs.apache.org/viewcvs/jakarta-lucene-sandbox/contributions/searchbea
n/

I have not completely moved it over, but this should give you a good start.
The real place to look is in the HitsIterator.

I hope this helps.

--Peter




On 6/19/02 10:50 AM, "Fanny Yeung" <toffeem@hotmail.com> wrote:

> Hi,
>
> Thanks the reply from Ype. Sorry, I am a newbie of lucene, would Ype give
me
> more details on how to implement it? Would the sorting affect the
> performance a lot?
>
> Many Thanks,
>
> Fanny
>
>> From: Ype Kingma <ykingma@xs4all.nl>
>> Reply-To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>> To: "Lucene Users List" <lucene-user@jakarta.apache.org>
>> Subject: Re: Sorting
>> Date: Wed, 19 Jun 2002 19:40:59 +0100
>>
>> Fanny,
>>>
>>> I want to implement search function using Lucene. As I need to sort the
>> result by number of indexed fields. (say 3 indexed fields). I am
wondering
>> how can I implement that. Can anyone give me some hints?
>>
>> The easiest way is to create an extra stored field with the number of
>> remaining
>> fields.
>> You could also store the names of the remaining fields and count these
>> before sorting. This gives you the bonus of allowing to search for the
>> presence of a field.
>>
>> Regards,
>> Ype
>>
>> --
>>
>> --
>> To unsubscribe, e-mail:
>> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
>> <mailto:lucene-user-help@jakarta.apache.org>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.
>
>
> --
> To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message