all groups > sql server full text search > september 2007 >
You're in the

sql server full text search

group:

Integration of Lucene.Net and SQL Server 2005?


Integration of Lucene.Net and SQL Server 2005? DC
9/11/2007 12:00:00 AM
sql server full text search:
Hi,

I am looking for an alternative to the SQL Server Fulltext Engine
since it is just not fast enough and does not offer the sorting I
require. Also, my customer wants a "did you mean google" when "gogle"
was entered feature. From what I have seen all that is possible with
Lucene.Net.

I am planning to export a table of about 3 Million keywords to
Lucene.Net and of course I have to implement a way to keep that index
up to date (a latency of one hour is allowed). Also, I would still
like to initiate searching through stored procs. Ideally a table-value
function with CLR integration would get a list of matching ID's from
Lucene.

I wanted to check if maybe someone has used such approach or heard
about something similar, or if there are general restrictions that
make the success of this approach unlikely.

TIA for any comments,

Regards
DC
Re: Integration of Lucene.Net and SQL Server 2005? Hilary Cotter
9/11/2007 12:00:00 AM
I did this. It works quite well. SQL FTS is faster at indexing and you have
to jump through hoops to get Lucene working correctly, but properly done it
is an alternative, especially when you need to do filtering.

--
RelevantNoise.com - dedicated to mining blogs for business intelligence.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: Integration of Lucene.Net and SQL Server 2005? Hilary Cotter
9/11/2007 1:22:10 PM
I am writing an article on it for simple-talk.

--
RelevantNoise.com - dedicated to mining blogs for business intelligence.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: Integration of Lucene.Net and SQL Server 2005? DC
9/11/2007 3:46:17 PM
[quoted text, click to view]

Thank you for letting my know, Hilary! That's encouraging. Do you
consider designing an "SQL Server / Lucene.Net Bridge" product?
Re: Integration of Lucene.Net and SQL Server 2005? Hilary Cotter
9/12/2007 12:00:00 AM
Here is the code. The field I am indexing and searching is Contents.

using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Collections;
using Microsoft.SqlServer.Server;
using Lucene.Net;
using Lucene.Net.Search;
using Lucene.Net.Documents;
using Lucene.Net.QueryParsers;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;


public partial class UserDefinedFunctions
{

[Microsoft.SqlServer.Server.SqlFunction(DataAccess =
DataAccessKind.Read,
FillRowMethodName = "FillRow", SystemDataAccess =
SystemDataAccessKind.Read, TableDefinition = "PK int")]
public static IEnumerable LuceneSearch(string SearchPhrase)
{
Searchable[] remoteSearch = new Searchable[7];
remoteSearch[0] = new IndexSearcher("//10.0.0.1/14");
remoteSearch[1] = new IndexSearcher("//10.0.0.2/15");
remoteSearch[2] = new IndexSearcher("//10.0.0.3/16");
remoteSearch[3] = new IndexSearcher("//10.0.0.4/17");
remoteSearch[4] = new IndexSearcher("//10.0.0.4/18");
remoteSearch[5] = new IndexSearcher("//10.0.0.4/18a");
remoteSearch[6] = new IndexSearcher("//10.0.0.4/19");
ParallelMultiSearcher searcher = new
ParallelMultiSearcher(remoteSearch);

QueryParser qp = new QueryParser("Contents", new
Lucene.Net.Analysis.Standard.StandardAnalyzer());
Query query = qp.Parse(SearchPhrase);

Hits hits = searcher.Search(query);

int[] PKs = new int[hits.Length()];
for (int i = 0; i < hits.Length(); i++)
{
Document doc = hits.Doc(i);
PKs[i] = int.Parse(doc.Get("PK"));
}

return postids ;
}

public static void FillRow(object row, out int PK)
{
PK= (int)row ;
}

};



--
RelevantNoise.com - dedicated to mining blogs for business intelligence.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
[quoted text, click to view]

Re: Integration of Lucene.Net and SQL Server 2005? DC
9/12/2007 7:17:43 AM
[quoted text, click to view]

Thank you! I will wait for that article before I do anything.

Regards
DC
AddThis Social Bookmark Button