SQLite implement Full Text Search

12/10/06

Permalink 10:57:53 pm, by Johan Carleson Email , 154 words, 95 views   English (UK)
Categories: Developer

SQLite implement Full Text Search

The new FTS1 module is the first in a planned series of loadable modules for SQLite that implement Full Text Search. The FTS1 module is available in SQLite version 3.3.8 and later.

Using FTS1
sqlite>create virtual table recipe using FTS1(name, ingredients);

You can insert rows into a full-text table in the same way as into an ordinary table with columns of type TEXT:

sqlite>insert into recipe (name, ingredients) values ('broccoli stew', 'broccoli peppers cheese tomatoes');
sqlite>insert into recipe (name, ingredients) values ('pumpkin stew', 'pumpkin onions garlic celery');
sqlite>insert into recipe (name, ingredients) values ('broccoli pie', 'broccoli cheese onions flour');
sqlite>insert into recipe (name, ingredients) values ('pumpkin pie', 'pumpkin sugar flour butter');

The MATCH operator performs a full-text match on a column in a full-text table:

sqlite> select rowid, name, ingredients from recipe where name match 'pie';

3|broccoli pie|broccoli cheese onions flour
4|pumpkin pie|pumpkin sugar flour butter
sqlite>

Trackback address for this post:

http://blog.carleson.net/htsrv/trackback.php/258

Comments, Trackbacks, Pingbacks:

No Comments/Trackbacks/Pingbacks for this post yet...

Comments are not allowed from anonymous visitors.

dev/null

warning: device /dev/null is full.

July 2008
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

Categories

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 38

powered by
b2evolution