Hi,

Sorry for the subject - I just do not know for what to search of what to 
ask - I actually do not know where is exactly my problem :-(

I have a database containing thousands of HTML pages ("topics"). There 
is a fulltext index for these topics. First there is a table containing 
all single words. Each word is identified by its "fulltextID":

CREATE TABLE fulltext(
        fulltextID INTEGER PRIMARY KEY,
        word VARCHAR(100) COLLATE NOCASE
);

Now there is a linking table between the words and the HTML pages (topics):

CREATE TABLE topic_fulltext(
        topicID INTEGER,
        fulltextID INTEGER,
        PRIMARY KEY(topicID, fulltextID)
);

Finding a topic containing a specific word is not too hard:

SELECT topic_fulltext.topicID
FROM fulltext
JOIN topic_fulltext ON topic_fulltext.fulltextID = fulltext.fulltextID
WHERE word LIKE 'Word%';

But now I want to be able to search with more complex queries. For example:

* List all topics containing (word1 AND word2)
* List all topics containing (word1 OR word2)
* List all topics containing (word1 AND word2 AND ... AND word10)
* List all topics containing ((word1 OR word2) AND word3 OR word3)
* ...

But now I have no clue how to accomplish this query. I just can't extend 
my single-word query from above :-(

Can anyone give me a hint?

Thank you very much,
Luke

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

Reply via email to