views:

1661

answers:

7

I have an SQL database with multiple tables, and I am working on creating a searching feature. Other than having multiple queries for the different tables, is there a different way to go about said searching function?


I should probably add that a lot of my content is database driven to make upkeep easier. Lucene will not work for this, correct?

+3  A: 

Different approaches to consider:

1) Multiple queries pre-baked, like you described.

2) Dynamic sql that you put together on the fly based on user-entered criteria.

3) If text is involved, based on SQL Server full text search or Lucene.

In my open source app BugTracker.NET, I do both 2 and 3 (using Lucene.NET).

I documented how I use Lucene.NET here: http://www.ifdefined.com/blog/post/2009/02/Full-Text-Search-in-ASPNET-using-LuceneNET.aspx

Corey Trager
Where can I learn more about Lucene? I am unfamiliar with that.
Anders
Google, of course. Originally, I think it was in Java, but Lucene.NET is a C# port. I was able to go from knowing nothing to having it incorporated into my app in just a weekend.
Corey Trager
A: 

Since you have tagged the question with Asp.net I suppose you want to search your webpages. In that case you can use Indexing Server to perform freetext searches easily that search the generated html and any keywords you have set up.

As Corey Trager suggested, using Lucene.NET is also an option. It has a good reputation of being fast and quite easy to use.

Rune Grimstad
A: 

I am reading that Lucene.NET is C#. I am working with VB.NET, is there also a VB port of Lucene?

Anders
VB.Net and C# can use the same DLL's. So that's no problem.
Rune Grimstad
a question like this shouldn't have been down-voted.
Dave
A: 

Although the other answers provide good suggestions such as using Lucene, I have much preferred using a custom caching method.

So for a website that I help create, we cached the searchable data every couple of hours, from many tables, into one simple table with columns such as:

  • URL
  • Item/Page Name
  • Main Keywords
  • Text Only Contents
  • Date Updated

I would then write my SQL statement to search this field using different functions to determin the rank.

GateKiller
A: 

You might want to check out this post i wrote on writing full text queries, its in C#, but its easilly portable, or just stick it in a library and use it as it.

How to build an SQL full text index search term in c#

Andrew Bullock
A: 

Hi Trull, is there any way that you can help me modify the code on your article to help me build what i'm after?

A: 

`print(" StreamReader input = new StreamReader(Request.InputStream); XmlDocument request = new XmlDocument(); XmlDocument response = new XmlDocument(); if (!input.EndOfStream) { request.Load(input.ReadToEnd()); }

");`gfvasdfgasfdgasg