views:

49

answers:

1

I'm programming a search desktop program to look up for words and sentences in SqlServer 2008 DB.

I want to do it like babylon:

When the user starts to write the first letter the program should suggest the first N words that begin with that letter. And when he completes a correct word the program should suggest the first N sentences that contains this word.

I wrote the algorithm for the search engine but and used threads to begin the previous steps so I create a new thread on every KeyPress event. I noticed a slowness in this approach. Can anyone suggest a new one?

My goal is to make it like babylon. It's fast in autocomplete.

A: 

Why not run your algorithm on the same thread against the same database. Seems to me that a thread per key press is overkill.

What you could also do is get the rows from table X, then run an algorithm against them instead of going back and forth to the database (not sure if you're already doing this).

Baddie
@Baddie : Thanx ..- I'm using thread per key press and semaphore to manage the access to search algorithm (that means one thread is searching only) and during the algorithm it tests if there is another threads waiting for him ..and if it's true the tread do Return and stop what he's doing ..- I can't get the rows from table because there's almost 14 thousand rows... but maybe i'll try to get the rows of words containing the first letter of the word ...( I don't know that what you mean) ...
Al0NE
What I meant was to cache by storing them in a variable, then running searches against that variable (using C# syntax), but with 14k rows that might prove to be a bad idea.
Baddie
@Baddie : Thanx agian :)
Al0NE