|Perl: the Markov chain saw|
Apologies, I'm not expressing myself terribly well. Let me explain what I'm ACTUALLY trying to achieve, and perhaps the solution will be more apparent.
I am building an autocomplete function of place names:
Currently, to find a list of relevant place names to return, I do a search against ElasticSearch (ES) based on the text a user has typed in. ES calculates a score based on the frequency of those ngrams, with the usual full-text-search relevance scoring. I then incorporate the "rank" (eg capital vs village) into that final score and sort the results using this final score.
I would like to add a geo-location element. So villages (low rank) close to (eg) your home town would score more highly than a city (high rank) 2000km away.
And I would like to be able to say that eg anything with 10km, or 100km or $x km (ie it should be configurable) is more relevant than it would be by just following the curve of the formula
But the value that gets returned (the boost) should range from (eg 0..10), so that the user of my module wouldn't have to guess about how much effect the value that they pass in might have on the results.
It may be that I'm over thinking this.