Full-text index implementation based on MSIndexServer

Source: Internet
Author: User
I have a hobby of adding a favorite to my favorites when I see good articles on the Internet. Currently there are articles of Mb on the machine, all of which have been stored by time and directory classification. However, it is inconvenient to search for it. Therefore, you want to create a knowledge base for full-text indexing. The full-text retrieval and indexserver of mssqlserver are available in the solution selection. In order to make a decision

I have a hobby of adding a favorite to my favorites when I see good articles on the Internet. Currently there are articles of Mb on the machine, all of which have been stored by time and directory classification. However, it is inconvenient to search for it. Therefore, you want to create a knowledge base for full-text indexing. In the solution selection, full-text retrieval of ms SQL server and index server are available. In order to make a decision

I have a hobby of adding a favorite to my favorites when I see good articles on the Internet. Currently there are articles of Mb on the machine, all of which have been stored by time and directory classification. However, it is inconvenient to search for it. Therefore, you want to create a knowledge base for full-text indexing.

In the solution selection, full-text retrieval of ms SQL server and index server are available. In order to make a decision, I raised the following requirements.

It is required that the Knowledge Base be split by time and directory;

Support for word, xls, txt, ppt, and html with images is required;

Supports aspx and pdf extensions;

Requirement Analysis:

For the above two problems, SQL server does not seem to be able to meet the following requirements:

Cause 1: I want to import the articles on the hard disk to the database, which requires a lot of work. Second, SQL server differential backup = the difference between the backup time and the first full backup. If there is this differential backup score = the first full backup score + the first N slave scores, that's fine.

Cause 2: many articles are HTML-based. With images. In SQL server, there is a one-to-many problem. It cannot be solved.

Cause 3: Full-text retrieval cannot be completed in real time.

Cause 4: after the document is placed in the database image type field, it must be viewed through a program. It is not directly stored on the hard disk for viewing convenience.

Therefore, index server is selected.

Process:

(Here we name it KB. The document to be indexed should be in the D: \ knowledge base \ C # knowledge base, and the index file should be placed in D: \ KB)

Start indexes on Windows 2000/XP;

By default, the Computer Management icon is located in the management tool group. The right side of the window provides information about the indexes that currently exist on the server. By default, two indexes are available: System and Web;

To create a new index, right-click the Index Service or the panel on the right, and select create catalog.

The add catalog dialog box is displayed. Specify the index name and click the Browse button to select a location. The indexing service does not start indexing immediately. A message box is displayed, and click OK to continue. To achieve optimal performance, the indexing service can be placed on a hard disk isolated from the Web server;

Specify the index directory, right-click the newly created directory name, and select Properties from the pop-up menu. The Dialog Box 2 is displayed. The first tab displays the content you just entered. Select the Web site you want to index from the WWW server drop-down list in the second tab trace;

With the created catalog, you can select the directories you want to include in the index.

Implementation Method:

You can use the index server in html pages. Refer to C: \ WINDOWS \ Help \ ciquery.htm, which is implemented using activex.

Here I use C # And oledb.

Microsoft has provided us with a ready-made oledb driver to access the index server. PROVIDER = MSIDXS. For more information about which columns can be selected, see the appendix.

private void BT_Search_Click(object sender, System.EventArgs e)
{
  string constr="PROVIDER=MSIDXS;DATA SOURCE=KB";
  OleDbConnection con=new OleDbConnection(constr);
  try
  {
    OleDbCommand cmd=new OleDbCommand();
    cmd.Connection=con;
    cmd.CommandText="SELECT Rank,FileName, Create, Access, Path
      FROM SCOPE()
      where CONTAINS (''\""+TB_Text.Text+"\"'')";
    OleDbDataAdapter da=new OleDbDataAdapter();
    da.SelectCommand=cmd;
    con.Open();
    DataSet ds=new DataSet();
    da.Fill(ds);
    dataGrid1.DataSource=ds;
  }
  catch(Exception E)
  {
    Console.Write(E.Message);
  }
  finally
  {
    con.Close();
  }

}

12 next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.