Mr. Hostetter, you are a Godsend. Just wanted to report to anyone following
this thread that Hoss's solution was perfect and I indeed was able to add a
new dynamically changeable Term frequency relevance scoring system. The
value of such a thing may not be high, but man do I love Lucene for making
it all possible.

Thanks Hoss.

- Mark

On 12/20/06, Chris Hostetter <[EMAIL PROTECTED]> wrote:

:
: problem reamins that I would like to be able to switch between the hits
: per doc Similarity and the default Similarity on  any given search. I
: was hoping that I could index with DefaultSimilarity and store the norms
: for normal relevancy searching. Then I would need to ignore or make
: constant the norms with a custom Similarity for hits per doc searching.
: It would seem that this is not as easy as I had hoped it might be.

not quite ... but it's not super tough.  if "reader" is what you use to
construct your IndexSearcher when you wnat norms, something like this
should work when you don't want lengthNorms...

   IndexReader noNormsReader = new FilteredIndexReader(reader) {
     byte[] ones = SegmentReader.createFakeNorms(maxDoc());
     public synchronized byte[] norms(String field) throws IOException {
       return ones;
     }
     public synchronized void norms(String field, byte[] result, int
offset) {
       System.arraycopy(ones, 0, result, offset, maxDoc());
     }
   }

it would be nice if encodeNorm, decodeNorm, and getNormDecoder weren't
static, so you could not only use whatever encoding you want at index
time, but could also ignore it alltogether at search time in the way you
describe ... but alas, that's just not the way it works -- changing it now
in a backwards compatible way would be a bit tricky.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to