Sunday, January 3, 2010

Hubble.net Demo configuration document

Step 1 Install Hubble.net


See this link: Installation of Hubble.net

Step 2 Login Hubble.net


Run QueryAnalyzer and input IP address point to the hubble.net service. Click Login then next step.

image

 

image

 

Step 3 Create database

Click File->Open
Choose CreateDatabase.sql then create News database

 

image

 

The sql for creating database is

 

exec sp_adddatabase 'News', 'd:\test\news\', 'SQLSERVER2005', 'Data 
Source=(local);Initial Catalog=News;Integrated Security=True'
;



 



The first parameter is the database name that refers to the Hubble.net. Here named News.

The second parameter is the default full-text index path of the database. Here is the “d: \ test \ news \”.


The third parameter is the default database adapter name


Here designated as SQLSERVER2005.  SQLSERVER 2005 database adapter can support SQLSERVER 2005 and later versions.



The fourth parameter is the default connection string, this string is used to connect relational database via Hubble.net.





Note: Before you create a database in hubble.net, you must create a database in SQLSERVER firstly. If you want to use other database in SQLSERVER, you only need to modify the connection string.





Click Excute



 



image



 



Choose the server node in the left, click right button and click Refresh. You can see the news database in the combobox.



 



Step 4 create table



 



 



Click File->Open then open CreateTableEng.sql,Choose news database at the combobox in up-left, click Excute。



 



image



exec sp_droptable 'news';
Create table News
(
Title nvarchar(max) Tokenized Analyzer 'EnglishAnalyzer' NOT NULL Default '',
Content nvarchar(max) Tokenized Analyzer 'EnglishAnalyzer' NOT NULL Default '',
Time Date Untokenized NOT NULL Default '1990-01-01',
Url nvarchar(max) NULL
);





The first line is to delete the news data table. If the news data table does not exist, this command will do nothing. The second part of command is to build the table. CREATE TABLE sql command like TSQL very much. You should specify the analyzer for the full-text field. Here is EnglishAnalyzer that is installed in hubble.net by default.  If you want to use other analyzer, you can implement the analyzer interface and install it in hubble.net.




Step 5 Import test data for news



 



File->Batch Import choose EnglishNews.sql.

You can download EnglishNews.slq on





http://hubbledotnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36585



 



image



 



Click Import then batch import news data。



 



Execute flowing sql after import finished to optimize the index.

exec SP_OptimizeTable 'News'



image



 



Test following sql:

select top 10 * from news where content match 'hello' order by score desc



 



image















 



Web configuration



<connectionStrings>
<add
name="News"
connectionString="Data Source=127.0.0.1;Initial Catalog=News;"
providerName="Hubble.SQLClient"
/>
</connectionStrings>



You can set the connect string for hubble.net at this section.





The Index.CacheTimeout in App_Code/Index.cs can set the data cache timeout for SQLClient.


Default is 0.


-1: There is no cache


0: Has data-cache, but the timeout is 0. This case, for each query, SQLClient will ask Hubble.net service about the table changing. If the table has not changed, read from the data cache, otherwise read from server.


N: Cache N seconds,  ask Hubble.net service about the table changing after time-out.



2 comments: