How to create a search engine for my application?

Nowadays, as a rule, there is a usual requirement to have a search function that can search almost everything you want. Can someone give me samples or tips on how to build a single point search for an application?

For example: you have 3 tables of customers, products, employees. The application has a main page with a text box in the right corner, very similar to what you have on stackoverflow.

How can I find a query for the term "Phoenix" and have results like

Customers

Result 1 ...... 

Products

 Result 1 ...... 

Staff

 Result 1 ...... 

Any tips, guides and hints would be really appreciated. My environment is Win2k3, .net3.5, C #, ASP.net.

EDIT: In particular, look at performance and scalability.

Thanks in advance!

+6
c # sql-server search linq
source share
7 answers

Lucene.NET is an extremely fast full-text search engine.

Sample Usage:

See DotNetKicks source code starting with codebehind search page

+3
source share

If you want something really scalable, I think you will have to first create a dictionnary of data by specifying each table and each column in your database. The building of such a table can be fully automated .

In this table you will indicate which fields are available for direct or soft (with a wild card) search.

Then you can create a good and convenient user interface where the machine can find that a code such as '*823*' applies to both account numbers 'INV-0823456' and 'INV-0880823' if the account number field is available for a soft search. The user may even be given the opportunity to choose which columns to search, since scanning all the phone numbers in the database may not always make sense.

You cannot try to index all columns that are searchable. A "full index" strategy can become very expensive in terms of disk space \ server overhead and will not make sense for rarely used columns. Do not worry about it: users do not mind the delay in receiving a response.

+2
source share

One way: find the desired value in all tables in the database . Of course, this code can be changed to focus on specific tables and columns.

+1
source share

Xapian is the open source search engine library with features you are looking for.

+1
source share

To follow the response of fallen888:

You can create a class with a method that takes an array or a list of keywords to enter. Create LINQ queries associated with each table, and for example, use the LIKE operator in some of the methods described in this blog post to search in the right order for columns to match content. Of course, this will not be very optimized, but it will work for small systems :)

0
source share

If you use SQL Server for your database, you can try a full text search of SQL. I have used it quite successfully.

0
source share

If you want to use a one-stop search solution and want the search to work on your site or blog for several minutes, you can always use BuildaSearch . BuildaSearch makes it easy to create custom searches. Just copy and paste your javascript code and instantly, you have a fully functional user search running on your site. The most interesting feature of this search service is that you do not need to write a single line of code and work in any web server environment.

0
source share

All Articles