trep/opentrep — Issue #1: Modularisation of the search algorithm
Author: denisarnaud
Created: 2012-01-01 19:52:14+00:00
State: open

The search algorithm is currently made of a single bloc. It should become modularised, with the full-text search just one of the features.

The search algorithm could be as follows:
- Perform the (Xapian-based) full-text search, as currently done. That full-text search returns:
- a list of main/idempotent matches, i.e., matches with the same match percentage, usually 100%, for instance when the search is done for a given country such as 'fr';
- potentially a list of alternative matches, i.e., matches with lower match percentages.
- All the matches are returned with their full details:
- Type (airport, city, hotel, train station, etc.).
- Geographical coordinates.
- Administrative hierarchy (city, country, continent).
- For every main and alternative match:
- Assign an overall mark, initialised with the 1 times the matching percentage: 100% => 1.
- Perform a geographical search on the airports nearby (say, 50 km around). Those airports are sorted according to their importance (https://github.com/opentraveldata/optd/blob/trunk/refdata/geonames/data/por/data/airports_pageranked_2010_06.txt).
- For every found airport, multiply its importance (page-rank) by the overall mark of the corresponding match.
- Choose a match