2012-07-05 4 views

답변

1

예를 들어서 다릅니다. "외부 콘텐츠 FTS4 테이블"을 사용하는 경우 자동으로 업데이트되지 않습니다.

http://www.sqlite.org/fts3.html#section_6_2_2

CREATE TABLE t2(id INTEGER PRIMARY KEY, a, b, c, d); 
CREATE VIRTUAL TABLE t3 USING fts4(content="t2", b, c); 

INSERT INTO t2 VALUES(2, 'a b', 'c d', 'e f'); 
INSERT INTO t2 VALUES(3, 'g h', 'i j', 'k l'); 
INSERT INTO t3(docid, b, c) SELECT id, b, c FROM t2; 
-- The following query returns a single row with two columns containing 
-- the text values "i j" and "k l". 
-- 
-- The query uses the full-text index to discover that the MATCH 
-- term matches the row with docid=3. It then retrieves the values 
-- of columns b and c from the row with rowid=3 in the content table 
-- to return. 
-- 
SELECT * FROM t3 WHERE t3 MATCH 'k'; 

-- Following the UPDATE, the query still returns a single row, this 
-- time containing the text values "xxx" and "yyy". This is because the 
-- full-text index still indicates that the row with docid=3 matches 
-- the FTS4 query 'k', even though the documents stored in the content 
-- table have been modified. 
-- 
UPDATE t2 SET b = 'xxx', c = 'yyy' WHERE rowid = 3; 
SELECT * FROM t3 WHERE t3 MATCH 'k'; 

에서

하지만 너무 트리거를 통해 해결 될 수있다. 대신 전체 텍스트 인덱스와 내용 테이블에 별도로 작성

, 일부 사용자 저장된 문서의 집합에 대한 날짜로 전체 텍스트 인덱스를 유지하기 위해 데이터베이스를 사용하는 트리거 할 수 있습니다 콘텐츠 표에 예를 들어 이전 의 예를 사용하는 테이블은 다음과 같습니다.