Friday, March 23, 2012

How to make a Fuzzy Search Engine

When i search for Peter.
Peter,Pan was successfully retrieved from the Database

But when i Search for Peter Pan.
It found no results.

How can i make it such tat it can find results for Peter Pan too?
In another words, how to make my search engine more powerful,fuzzy and intelligent?

My current Code:
<asp:SqlDataSource ID="dsSearch" runat="server" ConnectionString="<%$ ConnectionStrings:csHPDB %>"
SelectCommand="SELECT * FROM [employee_table] WHERE ([employee_name] LIKE '%' + @.employee_name + '%')
<SelectParameters>
<asp:QueryStringParameter Name="employee_name" QueryStringField="Search" Type="String" />
</SelectParameters>
</asp:SqlDataSource

Jabalang:

SelectCommand="SELECT * FROM [employee_table] WHERE ([employee_name] LIKE '%' + @.employee_name + '%')

If you want to use like searches only, then you'll have to separately code for each combination of words and/or phrases for your search. You can rather use Full Text Search for this and any other kind of fuzzy searches. Read BOL for this feature.

|||

what you mean? what is BOL? any links for this? thx

|||

ello?

|||

My apologies for the late reply. BOL means Books On-Line. What I meant was you can use a feature called Full Text Search to implement full text search. Like matches and other functions e.g. soundex have their own limitations. By setting Full Text search for your table and/or any of the columns, you can allow the users to search for any word or phrase ( just like google) and the results will be generated based on the full text index scan. Below are some links that can be useful for setting up full text search:

http://msdn2.microsoft.com/en-us/library/ms142571.aspx

http://msdn2.microsoft.com/en-us/sqlserver/aa336289.aspx

|||

oh.. cool.. so how do i implement it? any examples?

|||

Follow the links. Everything is in there explained very well.

|||

I'm using a Access Database .mdb format.

I tried using FREETEXT , but it didnt work.

Anyone has any idea to fix this problem?thx

|||

Jabalang:

I'm using a Access Database .mdb format.

You mean you're using Access as the database ? For this far, I was explaining you the feature of SQL Server.

|||

?yeah... i am using Microsoft Access As Database. So is there anyway to solve the problem?

|||

anyone help please... thx

|||

Sorry, but I don't use Access regularly so I don't have any idea as to whether its having this kind of feature or not.

|||

any body know how to make a fuzzy search engine? thx*2

|||

Hi Jabalang,

Based on my understanding, you want to build a search engine on your access database. However, since Full-Text-Index is not supported in access (I think it is only supported at Sql Server Enterprise Edition), you cannot use full-text index. If I've understand you wrong, please feel free to tell me, thanks.

I think in your case, if your bussiness logic does not involve too much data, you can use LIKE comparison. For example, if you want to search one record whose name is(or contains) "abc", you can write you select query like this:

select * from tbl_name where name LIKE '%abc%' For more information, click this link: http://msdn2.microsoft.com/en-us/library/ms179859.aspx

If your bussiness need a lot of data, or you have performance needs, I would suggest you use sql server enterprise instead (or at least standard version).

Hope my suggestion helps

|||

Bo - see here:http://forums.asp.net/t/1198035.aspx

No comments:

Post a Comment