lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: Search Order
Date Mon, 05 May 2008 17:37:46 GMT
Well, it all depends upon what you mean by problem. Lucene is not returning
things in random order, it's returning things in relevance order. There is
a lot of discussion about scoring both on the Wiki and in the mail archive
if you want to affect the return order.

Alternatively, you can sort your results by providing the search with
a Sort object, see the API documentation. But sort only works
on UN_TOKENIZED, single-token fields so that may not be what
you want.

You can also use one of the HitCollectors and sort the results
yourself if you so choose.

You can also work with boosts on the search to, say, make matches
in the title field count more when computing relevance than, say, text.

You can also boost documents at *index* time if you can say that
particular documents should tend toward the top of relevance searches.

If you'd explain a bit more what you want to accomplish, perhaps folks
can suggest more concrete actions. Why, for instance, is sorting by
relevance not appropriate? Have you indexed everything in your example
in just a big bag of words or have you indexed separate fields?

Best
Erick

On Mon, May 5, 2008 at 12:12 PM, Prashant Saraf <psaraf@cctc.com> wrote:

> Hi,
> I am creating a keyword based search engine. Now I am able to search the
> required data. Now, I notice that the data coming is in random order. Is
> there any way I can call particular record 1st. I have an example. Suppose I
> m working on search of Book content, writer, publication. Now if I enter
> name of title of book say java, but if there is another book who has content
> as word Java Coffee now it is showing that Book of coffee first. How to
> solve this problem.
>
>
> Thanks and Regards
>       प्रशांत सराफ
> (Prashant Saraf)
> SE-II
> Cross Country Infotech
> Ext : 72543
> www.crosscountry.in
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message