Mssqlserver full-text search

Source: Internet
Author: User
Tags mssqlserver
1. Change the file name during file storage 2. Configure the Index Server and associate the Index Server with MSSQLServer. 3. modify the SQL statement and add the content of the full-text query statement to the file stored in the query condition. For convenience of storage and indexing, we store the uploaded file in a directory, to ensure that the uploaded file names are not repeated, The GUID is used as the file name and associated with the record. At the same time, the file suffix is still original. 1. Change the file name during file storage.
2. Configure the Indexing Server and associate the Indexing Server with the ms SQL Server.
3. Modify the SQL statement and add the content of the full-text query statement to the query condition.
File storage method:
To facilitate storage and indexing, we store the uploaded files in a directory. To ensure that the uploaded files are not duplicated, we use GUID as the file name and associate the records with this GUID. At the same time, the file suffix also retains the original file suffix, so that the Indexing Service can recognize this document.
Configure index service
Go to the Computer Management Program (right-click my Computer> Manage) and find the Index Service)
Configure the Indexing Service Function
(1) Right-click the Index Service to bring up a menu
(2) Select New-> Catalog (create a New Catalog)
Set the newly added catalog
(1) enter the name of the catalog (this name needs to be associated with the database. Pay attention to the name. Here we assume that
(2) Click Browse to go to the Selection Index Service Running directory form.
(3) Select the index run directory created earlier (any place)
(4) Click OK to complete this operation
After creating a directory number, you must add a directory to the directory.
(1) Right-click the created catalog
(2) Select New-> Directory (New Directory)
Create INDEX DIRECTORY
(1) Click Browse to go to the directory selection page.
(2) Select the directory for full-text search
(3) confirm to complete this operation
Start Index Service after creation
(1) Start the Index Service
(2) After the Index Service is started successfully, the index information indicates that the service has been started successfully.
Associate the Index Service with the SQL database:
Execute the following stored procedure in the SQL Query Analyer
EXEC sp_addlinkedserver Dcs, -- Name of the connection server, which will be used for later Query
'Index Server ',
'Msidxs ',
'Dcci' -- Name of the newly created catalog in the Index Service
Method 1
(1) Right-click the Index Service
(2) select All Tasks-> Tune Perrformance
(3) Select User-Defined
(4) Click Customize to enter the performance adjustment form.
(5) Move the attributes of Index and Querying to the rightmost.
(6) Click OK to complete the operation
Performance adjustment method 2
If the server does not need to index the entire System file, you can stop or delete the System catalog.
MSSQL call to Index Server
1. query the content of the connection server through SQL statements
Select q .*
FROM OpenQuery (dcs, -- connection server name
'Select FileName, Size, DocAuthor, path -- SQL statement in the connection Server
From scope ()
Where contains (''' and abc '')'
) AS Q
2. Because SQL statements do not support dynamic input strings, query strings must be spliced in C # code.
S. p.

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.