Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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:

  1. Places could be districts, towns, cities, regions, countries.
  2. Each place has a "rank" eg a capital is more important than a village
  3. Each place also has a lat/long position
  4. Each place is indexed in ElasticSearch (a lucene based full text search engine) using edge-ngrams

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.


In reply to Re^4: [OT] Normalizing the return result of an exponential formula by clinton
in thread [OT] Normalizing the return result of an exponential formula by clinton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (14)
    As of 2014-04-18 14:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (469 votes), past polls