• Index Server 1


    由于网上的实例太多这就不对index server进行过多的描述,仅仅对代码中的极个别注意点进行说明,希望后来的和我一样走.net的人少些弯路.
    string constr="PROVIDER=MSIDXS;DATA SOURCE=IndexData";         //调用msidxs索引服务,并指定起编录(IndexData)
                OleDbConnection con=new OleDbConnection(constr);
                
    try
                
    {                                                             //通过Scope来指定查找范围
                    strOle="SELECT  Rank,FileName, Create, Access,  Path FROM SCOPE('"+strWhichMethod+" \""+strDataPath+"\"') where contains('xml')";  
                    OleDbCommand cmd
    =new OleDbCommand(strOle,con);
                    con.Open();
                    OleDbDataReader OleDaRead
    =cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    
    while(OleDaRead.Read())
                    
    {
                         arrFileName.Add( OleDaRead[
    "FileName"].ToString());
                    }

                    cmd.Dispose();
                }

                
    catch(Exception E)
                
    {
                    Debug.Write(E.Message);
                }

                
    finally
                
    {    
                    con.Close();
                }
    请注意 data souce 是指你在索引服务里自己创建的一个索引编录.这里的scope可以自己选择索引方法,比如在顶级目录下或在虚拟录下等,一共有四种在这里我都将其写为变量;各位自己调用scope提供的方法.已上就是我对index server的一点补充.
  • 相关阅读:
    动态规划算法1——背包问题
    图论——Dijkstra算法
    C++的输入和输出
    org.hibernate.type.SerializationException: could not deserialize 反序列化失败
    当json串传输异常(乱码破坏格式),服务器不能解析时,可以截取串达到取值的目的
    ReferenceError: ** is not defined
    jar包反复下载不成功
    include与.jspf
    url中“/”的意义
    JSP取得绝对路径
  • 原文地址:https://www.cnblogs.com/twilight/p/1401197.html
Copyright © 2020-2023  润新知