lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej Bialecki ...@getopt.org>
Subject Re: Set IDF value manually on a search query
Date Mon, 22 Mar 2010 18:35:58 GMT
On 2010-03-22 18:06, zsl wrote:
>
> I was thinking about that, but i dont know if it is the best option. Ty.

There is a certain trick to do this with the current API (let's hope the 
new API is more .. flexible .. ? ;) )

Implement a dummy Searcher that delegates most of its work to the real 
Searcher, except for docFreq(Term), where you return your arbitrary 
values. Then do Searcher.rewrite(Query) to expand the query, and then 
Query.weight(Searcher) to obtain a Weight - which uses your modified IDF.

Finally, use this Weight to run a query against your real Searcher.

You can see this approach implemented here:

https://issues.apache.org/jira/browse/SOLR-1632

though this contains some Solr-specific scaffolding, too.


-- 
Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


---------------------------------------------------------------------
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