I'm a little confused about why you need to cache it. If you use an
OpenBitSet based field cache, it remains there for the duration of your
index currency, doesn't it? How do you get the largest value? You sub-class
the cached field and add the numeric value field you're after. (If its
represented as a string forget this idea). When the indexreader is
opened/re-opened you re-init your the subCacheClass, and compute the
largest value 1x. That value remains current until the docs that have the
value are removed, or the cache needs a full reinit.
We did this at a large video site successfully (however my description may
be unsuccessful). Inside a custom scorer (with no sort fields needed) it
was straightforward to pull the needed value from the bitset based object
(since the bits represent the docids)
now, if that's confusing an older idea: generate a
GlobalStatisticsDocument, that has values in the fields that can never be
retrieved. And store the latest big value in a field there. Always re-index
that document into an "invisible" docid, that can only be instantiated (and
should need to be 1x per index open) for your scoring use (and other
nefarious non-user purposes.)
On Wednesday, September 26, 2012 4:26:37 AM UTC-4, ESFan wrote:
Hi now i have customscore "_score + ((parseInt(doc.ad_when.value) -
oldestAd) / paramNow) * 2". Is possible to use in custom score biggest
value from all docs.
in all docs i have popularity field and i want use biggest value from all
docs to customscore. is it possible?
Thanks for answers.