Hi, I'm experimenting with a few different scoring implementations and I was wondering what the easiest way would be to incorporate a new scorer into a searcher implementation.
>From reading the docs on Scoring at: http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/package-summary.html it seems that the path of least resistance would be to create an entire new hierarchy of class. 1. A new Query class to extend TermQuery with an appropriate implementation of TermWeight, 2. A new Scorer class to extend TermScorer with the appropriate Scorer implementation, and; 3. A new Similarity class which would provide the appropriate Similarity implementations. Given a new Query class I was at a loss when it came to instantiation. Would something like the following work -- i.e. is it sufficient to replace the top-level Query object, or would I need an implementation of a QueryParser that returns instances of the derived Query type. <pre> Query query = QueryParser.parse(queryString); ScopedQuery sq = new ScopedQuery(query); ScopedSimilarity ss = new ScopedSimilarity(); Searcher searcher = new IndexSearcher("path/to/index"); searcher.setSimilarity(ss); HitCollector hc = searcher.search(sq); </pre> With the following in ScopedQuery.ScopedWeight <pre> createScorer(IndexReader reader) { ... return new ScopedScorer(this, termDocs, similarity, reader.norms(term.field()); } </pre> I'm hoping that I won't need to implement a new Query parser. Thanks, - Shailesh PS: Perhaps a useful API call would be Searcher.setScorer(Scorer s), similar to the Searcher.setSimilarity call --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]