Lucene numDocs and doqFreq on custom similarity class
im doing an aplication with Lucene (im a noob with it) and im facing some problems. My aplication uses the Lucene 2.4.0 library with a custom similaraty implementation (the jar is imported)
In my app im calculating doqFreq and numDocs manually (im adding the values of all indexes and then i calculate a global value in order to use it on every query) and i want to use that values on a custom similarity implementation in order to calculate a new IDF.
The problem is that I dont know 开发者_运维技巧how to use (or send) the new doqFreq and numDocs values from my app on that new similarty implementation as I dont want to change lucene´s code apart from this extra class.
Any suggestions or examples? I read the docs but i dont now how to aproach this :s
Thanks
You can try extending IndexReader and overriding IndexReader.docFreq() and IndexReader.numDocs(). In this subtype you can supply that you are calculating manually. I'm not sure if there are other Lucene components that are dependent on those values, so you might want to tread carefully here.
精彩评论