See Also
You are here: Full-Text Indexing > Linking full-text index with a DB table
ContentsIndexHome
PreviousUpNext
Linking full-text index with a DB table
Linking full-text index with a DB table

 

The full-text indexes’ data source is the table. All data modifications and inserts applied on the table will be transparently committed to the full-text index for indexing/deleting. 

There are 2 ways to link the full-text index with the table. 

First, during table’s creation:

create table debate
(
postid int not null primary key,
threadid int,
dateline varchar,
title varchar,
pagetext text,
constraint debate_table_search freetext(postid,threadid,dateline,title,pagetext)
references debate_search(postid,threadid,dateline,title,pagetext)
)

In the example above we create full-text constraint “debate_table_search” which maps the table’s fields (postid,threadid,dateline,title,pagetext) to Lucene index “debate_search” fields (postid,threadid,dateline,title,pagetext). 

 

Note: Currently the table’s number of free text searchable columns must match the number of columns in the full-text index; however, the names and types can be different. If data type does not match, SQL optimizer will automatically perform conversion. 

Second, linking full-text index with the existing table:

alter table debate
(
add constraint debate_table_search freetext(postid,threadid,dateline,title,pagetext)
references debate_search(postid,threadid,dateline,title,pagetext)
)

Once linking complete, the content of “debate_search” will be truncated and repopulated with the content from “debate” table.