On 9/5/07, Chris Hostetter <[EMAIL PROTECTED]> wrote: > : - I thought about being able to include queries as a ValueSource (so > : one could do functions on relevancy scores). One issue with this is > : that some queries need rewriting to work... so rewrite functionality > : would need to be added to ValueSource. > > not neccessarily ... the getValues(IndexReader) method already sort of > serves the purpose of rewrite ... a "QueryValueSource" class could > rewrite the query in it's getValues method and use the resulting > query/weight/scorer in the DocValues object it returns.
Ahhh, of course. Thanks! > : - some field values may be sparse... so if you multiplied the > : relevancy query by field "myscore" which only existed on a few > : documents, you would not want to multiply the scores for other > : documents by 0. So either > > this sems like the kind of thing that could best be dealt with in > something like FieldValueSource -- where the underlying ValueSource > getting the field value decides what value to use if the doc doesn't have > one. The main problem being knowing if a doc had a value, right? The FieldCache doesn't always store that info (only for string-based types). One only has an IndexReader at that point, so it could be hacked together with a CachingWrapperFilter on a RangeFilter for that field. Or I guess perhaps not even using the FieldCache at all... but the memory duplication would be undesirable if a FieldCacheSource or FieldCache for the same field was used elsewhere. -Yonik