How do I query for records ordered by similarity?

Eg. searching for "Stock Overflow" would return

  1. Stack Overflow
  2. SharePoint Overflow
  3. Math Overflow
  4. Politic Overflow
  5. VFX Overflow

Eg. searching for "LO" would return:

  1. pabLO picasso
  2. michelangeLO
  3. jackson polLOck

What I need help with:

  1. Using a search engine to index & search a MySQL table, for better results

    • Using the Sphinx search engine, with PHP

    • Using the Lucene engine with PHP

  2. Using full-text indexing, to find similar/containing strings


What does not work well

  • Levenshtein distance is very erratic. (UDF, Query)
    Searching for "dog" gives me:
    1. dog
    2. bog
    3. ago
    4. big
    5. echo
  • LIKE returns better results, but returns nothing for long queries although similar strings do exist
    1. dog
    2. dogid
    3. dogaral
    4. dogma
Edit
Report