Is there a standard programming idiom for adding extra data to an index that has been created? I am trying to write code to index and search a set of documents using the BM25 algorithm, so (as I understand it) I need to store the length of each document somewhere and the average document length for the collection somewhere (and, I guess, the number of documents that have been indexed at any point so I can keep a running average). It seems like it would make sense to store these values in the index somehow so they are available to the search code. Is there sample code somewhere that describes how to do something like this? Or is there a better way that I'm not thinking of? Thanks.
Mike O'Leary