views:

129

answers:

2

I want to add a search engine to my website. I want it to handler boolean searches and give me a list of results in order or best match. I need it to be able to work with LINQ, because I want to add additional where clauses to the final query that gets run. I am looking for the best open source .NET search engine that works with LINQ. I like lucene.net but the problem is the LINQ interface (LINQ to Lucene) hasn't been updated since 2008. Are there any good options out there?

+1  A: 

You could try and use the free Search Server Express from Microsoft. It's available in beta for the 2010 version but will be released soon. The (SharePoint) Search API is very similar similar to SQL, so you could append additional where clauses.

It's not linq or open source, but it's free and might work in your case. I've looked a bit at the lucene linq api myself, and came to the same conclusion you have. It's not updated, while Lucene is still being worked on.

The other option is to create your own Lucene Linq provider, but it will require some work.

Documentation for the FullTextSqlQuery class. (old version docs with sample here)

Here's a code snippet to show what it looks like:

FullTextSqlQuery fullTextSqlQuery = new FullTextSqlQuery(site)
fullTextSqlQuery.QueryText = String.Format("SELECT Title, SiteName, Path FROM Scope() WHERE \"scope\"='All Sites' AND CONTAINS('\"{0}\"')", searchPhrase),

and you could append more to the WHERE part of the query.

Mikael Svenson
Mikael, I really appreciate your suggestions. I don't think Search Server is an option right now because i need it to work on a shared web server (can't install software) and i need it to work with LINQ.Also i don't have the time to invest creating a lucene linq provider, I'd rather find something that exists already :/
Noel
Bear in mind that linq is just a provider/wrapper for the underlying API it implements. You should very well be able modify the query with custom code instead of linq. If you think about joining with linq from another data source (objects, db etc), that might very well not work.What does your lucene query look like, and how do you need to modify it?
Mikael Svenson
A: 

I decided to use full-text indexing feature of sql server. It's not as full featured as lucene.net but for my requirements it gets the job done pretty well.

Noel