日期:2014-05-19  浏览次数:20538 次

不太了解全文检索希望有人指点一下
想了解一下这个东西有没有人可以指点一下
然后可以自己做一个
谢谢

------解决方案--------------------
private void FileSearch(string catalog)
{
//全文检索的数据库连接及操作
Database mySQL = new Database();
DataSet ds = new DataSet();
String myConnStr = "Provider=MSIDXS; Data Source= " + catalog+ "; ";
String mySql = "SELECT FileName, Path, Characterization, Rank, Create, Size FROM SCOPE() WHERE CONTAINS ( ' " + keyString + " ')> 0 ";
OleDbConnection myConn = new OleDbConnection(myConnStr);
OleDbDataAdapter myAdapter = new OleDbDataAdapter(mySql,myConn);
try
{
myAdapter.Fill(ds, "Search ");
}
catch (Exception ex)
{
UDS.Components.Error.Log(ex.ToString());
Response.Redirect( "../Error.aspx ");
}
finally
{
myAdapter =null;
myConn.Close();
myConn = null;
}

//将全文检索的数据填充到临时表中
for(int i=0;i <ds.Tables[ "Search "].Rows.Count;i++)
{
DataRow myDr;
myDr = ds.Tables[ "Search "].Rows[i];

SqlParameter[] pparameters = {
mySQL.MakeInParam( "@FileName ",SqlDbType.VarChar,300,myDr[ "FileName "]),
//mySQL.MakeInParam( "@Path ",SqlDbType.VarChar,300,myDr[ "Path "].ToString().Replace(Server.MapPath( "..\\UnitiveDocument\\Document ").Replace( "/ ", "\\ ").ToLower() , " ") ),
mySQL.MakeInParam( "@Path ",SqlDbType.VarChar,300,Enter.changeString_Path(myDr[ "Path "].ToString())),
mySQL.MakeInParam( "@Characterization ",SqlDbType.NText ,10000,myDr[ "Characterization "] ),
mySQL.MakeInParam( "@Rank ",SqlDbType.VarChar,300,myDr[ "Rank "]),
mySQL.MakeInParam( "@Create ",SqlDbType.DateTime ,10,myDr[ "Create "]),
mySQL.MakeInParam( "@Size ",SqlDbType.Int,4,myDr[ "Size "])
};
mySQL.RunProc( "sp_AddScope ",pparameters);
}


http://www.it-school.cn/html/J2EE-EJB-JMS/200611/130288.html