Queries and Documents in my collection have multiple fields: some numeric and some textual. I know how to define custom Similarity classes per field in Lucene: so I have my textualSimilarity (tf.idf based) and a numericalSimilarity class (both extending Similarity)

I'm now studying how to implement such numericalSimilarity. I have a math formula " (queryNumber - docNumber) / normalization factor) to define the similarity between numeric fields.

But how can I implement this formula in the numericalSimilarity class ? Which methods should I extend ?