Full-text search using Hubble. net

Source: Internet
Author: User

1. Download and install

Download the installation file from the download Tab Of The hubble.net project homepage http://hubbledotnet.codeplex.com/

Download different installation packages based on your operating system. My system is a 32-bit Windows 7 system, so I download

It is best to download the latest version, because the new version is an improvement and repair for the old version.

Hubble. Net is an open-source project, so you can download their source code and learn it.

You can also download some documents to learn about the installation and Hubble. Net user manual, as well as the demo.

During installation, you can view the installation documentation
2. Configure Hubble. net
Freight expert
After installation, you can apply it to the system. Program The relationship between the query Analyzer Application, Hubble. net, and relational database is mainly configured through this tool. For more information about how to use the query analyzer, see <query analytics' use of analyzer>

Iii. Requirements

1. Hubble. Net does not have an entity database. It just creates a folder under a directory on the hard disk to store the index file. This index is similar to the dictionary retrieval directory.

2. the relational database and the Hubble. NET database should be created separately, first in the SQL Server managerment
Create a relational database in studio, and then create a database in query analyzer and establish a relationship with the relational database; query
Analyzer can operate tables in both the Hubble. NET database and relational database.

Iv. project applications

(1) configure the webconfig File

<Connectionstrings>

<Add name = "hubblenetconnection" connectionstring = "Data
Source = 127.0.0.1; uid = sa; Pwd = 123456; initial catalog = News ;"
Providername = "Hubble. sqlclient"/>
Women's brand list
</Connectionstrings>

(2) Add the corresponding dynamic link library in the bin of the web Project

(3) connect Hubble. Net to get Dataset

Connectionstringsettings connstring = webconfigurationmanager. connectionstrings ["hubblenetconnection"];
Using (hubbleconnection conn = new hubbleconnection (connstring. connectionstring ))
{
Conn. open ();

Getcolumnanalyzername (Conn, "news ");
Hubblecommand matchcmd = new hubblecommand (conn );

string wordssplitbyspace;
string titlematchstring = matchcmd. getkeywordanalyzerstringfromserver ("news", "title", keywords, Int. maxvalue, out wordssplitbyspace);
string contentmatchstring = matchcmd. getkeywordanalyzerstringfromserver ("news", "content", keywords, Int. maxvalue, out wordssplitbyspace);

// query a single table
hubblecommand cmd = new hubblecommand ("select between {0} to {1} * from news where content match {2} or title ^ 2 match {3} order by score DESC, time DESC ",
Conn, (pageno-1) * pagelength, pageno * pagelength-1, contentmatchstring, titlematchstring);

// Query multiple tables (note the following: 1. Add [unionselect] Before SQL; 2. Specify the fields to be searched *; 3. Fields returned by each SQL statement must be the same and the number of returned records must be the same. 4. Separate multiple SQL statements with semicolons)
// Hubblecommand cmd = new hubblecommand ("[unionselect] select between {0} to {1} title, content, URL, time from news where content match {2} or title ^ 2 match {3} order by score DESC, time DESC; select between {0} to {1} title, content, URL, time from activity where content match {2} or title ^ 2 match {3} order by score DESC, time DESC ",
// Conn, (pageno-1) * pagelength, pageno * pagelength-1, contentmatchstring, titlematchstring );

Newsdataset = cmd. Query (cachetimeout );
}

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.