lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: per-field similarity
Date Wed, 25 Jun 2008 21:20:03 GMT
On Wed, Jun 25, 2008 at 5:06 PM, Chris Hostetter
<hossman_lucene@fucit.org> wrote:
> Hmmm... that seems like it would be confusing: particularly since in the
> IndexWriter case the "Query" param would never make sense.  changing
> IndexWriter.getSimilarity to take a "String fieldName" and changing
> Searcher.getSimilarity to take "String fieldName, Query q" seem like they
> would be more straight forward.

That would require a user to subclass both IndexWriter and Searcher.
Since Similarity is already passed around, adding a factory method
their seems like the easiest approach.  It's also a class, so we could
easily add a method.

An optional Query param or other context (or more than one factory
method) was just a quick idea... may or may not ultimately make sense.

> (There's also the potential ambiguity of "how many times do i call
> Similarity.getSimilarity() before i stop?" ... it may seem silly, but if
> you're working in a Query or Scorer or Weight you may not be sure if it's
> been done yet)

Once per level?  When creating the Weight I would think.  If you call
again, the default impl would return "this".

It might be a little cleaner to pass around a SimilarityFactory, but
that ship has sailed IMO (along with many others :-)

-Yonik

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


Mime
View raw message