3

How to write a database driven auto-suggestion search using python, mysql and jquery? Are there any relevant tutorials. Because Googling just gave me several results for PHP but not anything relevant to Python.

Chinmay Kanchi
  • 62,729
  • 22
  • 87
  • 114
user426795
  • 11,073
  • 11
  • 35
  • 35

2 Answers2

2

There is a nice jQuery plugin for this, http://docs.jquery.com/Plugins/autocomplete. To use your data with it, you need to write a controller in python that returns the autocomplete data as a JSON structure.

You also need to pick a good framework for writing the actual controller in, check this question for some good suggestions: Recommendations of Python REST (web services) framework?

Community
  • 1
  • 1
Joakim Lundborg
  • 10,920
  • 6
  • 32
  • 39
2

Auto complete is generally implemented in a similar manner to spell checkers. Here's an article from Nick's Blog about Levenshtein Autonoma. It's written in python so you can follow along. I said generally before because while this will do spell checking and suggest similar names, it fails at anticipating where the popular queries are being done. For that, a naive approach would be a binary search tree where you've weighed the nodes based on the popularity of their search.

wheaties
  • 35,646
  • 15
  • 94
  • 131