1

I have a website that gets daily 5000 hits on an average. It has got autocomplete search box on all pages. I have around 5000 keywords in my database, which will grow gradually. I make ajax call to ashx handler, as soon as user enters 3rd character in to autocomplete search box. Ashx handler then fetches all the keywords from database that 'starts-with' the user's query.

But I find this process slow. I am thinking of 2 options here.

1. Storing the keywords in xml file. And then processing this file for keyword search using any of the techniques like XpathNavigator, Linq etc.

2. Storing all the keywords into a SortedList/ Hashset object and saving this object into cache.

I am unable to decide which option will be feasible for me. What will be the performance overhead or risk of saving the whole object into cache?

1 Answers1

3

Use a Trie tree, it is the data structure being used by search engines and autocomplete dictionary in mobile phones

TravellingGeek
  • 1,581
  • 11
  • 16