My program stores a bunch of text in an FTS4 table and makes it available for 
search. The wrinkle is, there are conceptually different projects for which the 
search has to be compartmentalized.

CREATE TABLE projects (project_id INTEGER PRIMARY KEY, project_name TEXT);
CREATE TABLE documents (document_id INTEGER PRIMARY KEY, document_name TEXT .., 
project_id INTEGER);
CREATE VIRTUAL TABLE fts_docs USING fts4 (document_id, content);

Now, when I search for terms, I would like to target only the content for a 
particular project. Would something like the following work --

SELECT Snippet(fts_docs), f.document_id 
FROM fts_docs f JOIN 
     documents d ON f.document_id = d.document_id JOIN 
     projects p ON p.project_id = d.project_id 
WHERE fts_docs MATCH ? AND p.project_name = 'this old project';

or, is there some other way to restrict the MATCH search to only certain rows 
in the fts table?

Puneet.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to