lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: How to give a score for all documents?
Date Tue, 25 Aug 2009 16:17:29 GMT
Can you please elaborate more on the use case? Why if a certain document is
irrelevant to a certain query, you'd like to give it a score? Are you
perhaps talking about certain documents which should always appear in search
results, no matter what the query is? And instead of always showing them,
you'd like to give them a "static score", so that they can compete w/ other
docs?

If that's the case, I think you can use a BooleanQuery such that the user
query is added as a clause and then you add another clause (MUST) which is
in fact a MatchAllDocsQuery or something like that which returns a
customized score. It's expensive though as for each query you'll score all
docs in the index.

But I don't think that will help (at least for this use case) since every
relevant document to the query will be added the same score as an
'irrelevant' document, which means the relevant docs will still win, no?

Shai

2009/8/25 Fabrício Raphael <fabriciorsf@gmail.com>

> I already know about this, but I want to give a customized score for all
> documents in collection, independent if wache document is or isn't relevant
> to the vector model.
>
> The similarity function is called only when the document is relevant to the
> vector model.
>
> Do you understand me?
>
> Thanks!
>
> On Sat, Aug 22, 2009 at 2:28 AM, prashant ullegaddi <
> prashullegaddi@gmail.com> wrote:
>
> > If you want to modify the way Lucene scores documents, I guess you need
> to
> > extend Similarity class and provide your own implementation. Take a look
> > at:
> >
> >
> >
> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/DefaultSimilarity.html
> >
> >
> http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/Similarity.html
> >
> > Thanks,
> > Prashant.
> >
> > 2009/8/21 Fabrício Raphael <fabriciorsf@gmail.com>
> >
> > > How to give a customize score for all documents independent of the
> vector
> > > model?
> > >
> > > I already know how to give a customize score, but I want to give this
> > > customize score for all documents in the collection, regardless of what
> > is
> > > relevant to the vector model.
> > >
> > > How to do this?
> > >
> > > Now, thanks!
> > >
> > > --
> > > Fabrício Raphael
> > >
> >
>
>
>
> --
> Fabrício Raphael
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message