On Wed, Jun 25, 2008 at 5:06 PM, Chris Hostetter <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]