2012年3月26日星期一

Full text search microsoft index server on .NET using C#

Hi,
I used the following code for an index search on specific folder.
{
//create a connection object and command object, to connect the Index
Server
System.Data.OleDb.OleDbConnection odbSearch = new
System.Data.OleDb.OleDbConnection( "Provider=\"MSIDXS\";Data
Source=\"SearchFolder\";");
System.Data.OleDb.OleDbCommand cmdSearch = new
System.Data.OleDb.OleDbCommand();
//assign connection to command object cmdSearch
cmdSearch.Connection = odbSearch;
//Query to search a free text string in the catalog in the contents of
the indexed documents in the catalog
string searchText = txtSearch.Text.Replace("","");
cmdSearch.CommandText = "select doctitle, filename, vpath, rank,
characterization from scope() where FREETEXT(Contents, "+ searchText
+") order by rank desc ";
odbSearch.Open();
I m able to get the TEXT search results. But full text search results
are reqiuired... like suppose if i search for experts release then i
need to get those documents where both the words exists..not only one
word.
Please let me know how to do this on .NET using C#.
Awaiting for the response.
Regards,
Rojasri.
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/Full-Text-se...ict228634.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=790451
use a contains based search for this.
ie
//Query to search a free text string in the catalog in the contents of
the indexed documents in the catalog
string searchText = txtSearch.Text.Replace("'","''");
cmdSearch.CommandText = "select doctitle, filename, vpath, rank,
characterization from scope() where CONTAINS(Contents, '"+ searchText
+"') order by rank desc ";
BTW - this is an indexing services question. It should be posted in
Microsoft.public.inetserver.indexserver
Hilary Cotter
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
"rojasree" <UseLinkToEmail@.dbForumz.com> wrote in message
news:4_790451_42f97e43956785fa721f58da989a05d8@.dbf orumz.com...
> Hi,
> I used the following code for an index search on specific folder.
> {
> //create a connection object and command object, to connect the Index
> Server
> System.Data.OleDb.OleDbConnection odbSearch = new
> System.Data.OleDb.OleDbConnection( "Provider=\"MSIDXS\";Data
> Source=\"SearchFolder\";");
> System.Data.OleDb.OleDbCommand cmdSearch = new
> System.Data.OleDb.OleDbCommand();
> //assign connection to command object cmdSearch
> cmdSearch.Connection = odbSearch;
> //Query to search a free text string in the catalog in the contents of
> the indexed documents in the catalog
> string searchText = txtSearch.Text.Replace("'","''");
> cmdSearch.CommandText = "select doctitle, filename, vpath, rank,
> characterization from scope() where FREETEXT(Contents, '"+ searchText
> +"') order by rank desc ";
> odbSearch.Open();
>
> I m able to get the TEXT search results. But full text search results
> are reqiuired... like suppose if i search for 'experts release' then i
> need to get those documents where both the words exists..not only one
> word.
> Please let me know how to do this on .NET using C#.
> Awaiting for the response.
> Regards,
> Rojasri.
> --
> Posted using the http://www.dbforumz.com interface, at author's request
> Articles individually checked for conformance to usenet standards
> Topic URL:
http://www.dbforumz.com/Full-Text-se...ict228634.html
> Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbforumz.com/eform.php?p=790451
sql

没有评论:

发表评论