Kouhei Sutou
null+****@clear*****
Wed Apr 22 20:33:11 JST 2015
Kouhei Sutou 2015-04-22 20:33:11 +0900 (Wed, 22 Apr 2015) New Revision: e98adb53f33d27f2e97b45e5f01ee72a982c8683 https://github.com/pgroonga/pgroonga/commit/e98adb53f33d27f2e97b45e5f01ee72a982c8683 Message: pgroonga.score: support HOT update Added files: expected/full-text-search/text/single/score/hot_updated.out sql/full-text-search/text/single/score/hot_updated.sql Modified files: pgroonga.c Added: expected/full-text-search/text/single/score/hot_updated.out (+24 -0) 100644 =================================================================== --- /dev/null +++ expected/full-text-search/text/single/score/hot_updated.out 2015-04-22 20:33:11 +0900 (d8f1e1a) @@ -0,0 +1,24 @@ +CREATE TABLE memos ( + id integer PRIMARY KEY, + tag varchar(256), + content text +); +CREATE INDEX grnindex ON memos USING pgroonga (id, content); +INSERT INTO memos VALUES (1, 'pgsql', 'PostgreSQL is a RDBMS.'); +INSERT INTO memos VALUES (2, 'groonga', 'Groonga is fast full text search engine.'); +INSERT INTO memos VALUES (3, 'pgsql', 'PGroonga is a PostgreSQL extension that uses Groonga.'); +UPDATE memos SET tag = 'groonga' + WHERE id = 3; +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; +SELECT id, content, pgroonga.score(memos) + FROM memos + WHERE content @@ 'PGroonga OR Groonga'; + id | content | score +----+-------------------------------------------------------+------- + 3 | PGroonga is a PostgreSQL extension that uses Groonga. | 2 + 2 | Groonga is fast full text search engine. | 1 +(2 rows) + +DROP TABLE memos; Modified: pgroonga.c (+3 -1) =================================================================== --- pgroonga.c 2015-04-22 19:44:02 +0900 (ecdfc92) +++ pgroonga.c 2015-04-22 20:33:11 +0900 (dd03477) @@ -913,13 +913,15 @@ PGrnIsAliveCtid(Relation table, ItemPointer ctid) Buffer buffer; HeapTupleData tuple; Snapshot snapshot; + ItemPointerData realCtid; bool allDead; bool found; bool isAlive; buffer = ReadBuffer(table, ItemPointerGetBlockNumber(ctid)); snapshot = RegisterSnapshot(GetLatestSnapshot()); - found = heap_hot_search_buffer(ctid, table, buffer, snapshot, &tuple, + realCtid = *ctid; + found = heap_hot_search_buffer(&realCtid, table, buffer, snapshot, &tuple, &allDead, true); isAlive = (found && CtidToUInt64(&(tuple.t_self)) == CtidToUInt64(ctid)); UnregisterSnapshot(snapshot); Added: sql/full-text-search/text/single/score/hot_updated.sql (+23 -0) 100644 =================================================================== --- /dev/null +++ sql/full-text-search/text/single/score/hot_updated.sql 2015-04-22 20:33:11 +0900 (3400881) @@ -0,0 +1,23 @@ +CREATE TABLE memos ( + id integer PRIMARY KEY, + tag varchar(256), + content text +); + +CREATE INDEX grnindex ON memos USING pgroonga (id, content); + +INSERT INTO memos VALUES (1, 'pgsql', 'PostgreSQL is a RDBMS.'); +INSERT INTO memos VALUES (2, 'groonga', 'Groonga is fast full text search engine.'); +INSERT INTO memos VALUES (3, 'pgsql', 'PGroonga is a PostgreSQL extension that uses Groonga.'); +UPDATE memos SET tag = 'groonga' + WHERE id = 3; + +SET enable_seqscan = off; +SET enable_indexscan = on; +SET enable_bitmapscan = off; + +SELECT id, content, pgroonga.score(memos) + FROM memos + WHERE content @@ 'PGroonga OR Groonga'; + +DROP TABLE memos; -------------- next part -------------- HTML����������������������������... Descargar