19

I want to implement a "text" suggestion.

I have a huge number of data, how I can implement an efficient and scalable auto-complete?

Edit 1: i have a mysql table with one client per row and a 'name' column, i want to create a suggest in order to search client name (like google suggest but instead of queries it is client name) - I have a huge numbers of rows, how I can design an efficient suggest?

When user will start typing inside an "input text", I want to display possible client names

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
JohnJohnGa
  • 15,446
  • 19
  • 62
  • 87
  • What are you trying to suggest? – Kiril Aug 14 '11 at 18:17
  • you might want to post this on code golf since you haven't specified a language – Alex Coplan Aug 14 '11 at 18:18
  • @Alex Coplan - I am looking for an algorithm, it can be done in C# or Java and for sure JS – JohnJohnGa Aug 14 '11 at 18:19
  • @JohnJohnGa, you want to suggest a client's name from the content of a text file? Can you please explain what that means...? What's in the text file, what is the client name, what is the client trying to do? – Kiril Aug 14 '11 at 18:20
  • @John OK, I'm reading too many things here: you have a text file which you want to parse, you have an SQL table which contains a client's name, you want to suggest a client's name... how are all these things related? – Kiril Aug 14 '11 at 18:23
  • 4
    Suggestion: pretend like nobody here has any clue what you're talking about and explain **exactly** what you're trying to do (in detail). – Kiril Aug 14 '11 at 18:25
  • @JohnJohnGa, please revise your question based on the comments; also, please explain exactly what you're trying to do. I would love to help you, but I just don't know what you're asking at the moment. – Kiril Aug 14 '11 at 19:43
  • @Lirik I revised my question - sorry and thanks for your help – JohnJohnGa Aug 14 '11 at 19:59
  • Please define 'huge' and also 'distinct huge'. I might have something to add here if I find some time... – Marsellus Wallace Jun 04 '16 at 03:38

1 Answers1

25

OK, I think I understand what you're looking for and here are some possible solutions for you:

Essentially, it seems like you're looking for auto-complete functionality (if I understood your question correctly). Along those lines, the above questions and their answers also provide a lot of references on how to do more complex suggestions (i.e. based on content, semantics, intent, etc.).

This will probably not address your question if you're looking for an algorithm that makes "related" suggestions, e.g.:

  • "water" may suggest kool-aid, gatorade, vitamin water.
  • "sea" may suggest ocean, lake, river
Community
  • 1
  • 1
Kiril
  • 39,672
  • 31
  • 167
  • 226