问题描述:

So, I have a website with a search bar.

I have only figured out how to get results when they match (at least in part using Like %searchterm%) and it works.

Obviously, this does not help me if the user misspells something.

We have discovered through HeatMapping that we are losing people on this.

How can I implement a "smarter" search feature?

Thanks,

Yoni

网友答案:

The "real" solution that you are looking for might be more complicated than you think. You could use simpler solution that will work fine like using the DIFFERENCE function.

网友答案:

I am trying to leave a comment, but not able to. So i have to leave it here, and it might not be the ideal answer Yoni is expecting. I can think of two ways of doing it.

  1. use asp.net autocomplete function. It will query the db, and feed the user back with suggested search results dynamically when users are typing which will prevent users mistyping somehow. many search engines use it frequently like Google, Yahoo. In asp.net, its very easy to wire it up.

ASP.NET Auto Complete

This is how Auto complete looks like

  1. add a class to re-process the search terms before querying the database, so you wont get 0 hit if users mis-spell or mis-type something. This is very broad, and it varies a lot depending on your business model concept.

Hope it helps. :)

网友答案:

This is quite a complex matter, impacting on both coding complexity and query performances. Of course there may be a lot of approaches to achieve the results you ask for.

Personally, I would start by working with aliases: for each word that user may search for, I would create a set of aliases, that may be related to word semantic value or to mistyping of the word itself, eg:

Word: sheet

Aliases: paper, shet, shee ...

So, each single word must be indexed (and this could be a cumbersome aspect to deal with, depending on your contents), and for each woed there may be many aliases.

Then apply a sequential logic like the following:

1 - standard search, as the one you already did

-> if nothing matches

2 - alias search

-> if nothing matches

3 - start "playing" with wildcard characters (this could definitely kill your db however)

I understand this is a quite generic answer, but I don't think there may be an absolutely good approach - performance wise - to your question.

相关阅读:
Top