Search, No results, Give Suggestion

  • Hi guys, I have a Search and Result pages in asp.net. If the user searched for a word but if he typed it in wrong spelling(e.g. tommorow), I want to show him that there's no record found in the database AND give him word suggestion/s(e.g. did you mean tomorrow? -- which has entry in our database)

    I have this table fully-text-indexed.

    How do I write the SQL statement for that?

    Any ideas and advice is appreciated.

    Cheers

  • OK, this is going to be along post and not sure it will solve your problem...

    What you are trying to achieve is divided into 2 categories:

    1. Finding similarity between your indexed words and the sought text

    2. Using Full Text Search

    Well, the two just don't go together...

    FTS doesn't allow you to iterate or enumerate all the keywords it indexed, so you'll need a third party tool. The one I'm using is DTSEARCH and it does a great job compared to FTS, but that's for another post. You might try LOGPARSER and use its -i:TEXTWORD option to get a list of all the unique words in your text.

    After obtaining the keyword list, you will need to apply some sort of similarity algorithm. The most common for this kind for task is Levenshtein distance. It even has its SQL port somewhere on the web.

    Last but not least, you might wanna try ASPELL open source speller but that will not promise any relation between the suggested corrections and your actual content.

    One more thing: This is my specialty so if you need further help, links or answers - just ask.

    Yours

    Tal Ben Yosef

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply