Subject | Search strategy |
---|---|
Author | Bob Murdoch |
Post date | 2004-04-19T12:52:38Z |
I'm working on an application that will maintain a list of keywords
associated with a row of a table. The row will contain a blob which will
be used to store a document or an email message ('article'). The user will
be able to run a query, searching for articles that contain a number of
keywords. The table structure will look something like this:
create table keyword(
keyword_id integer not null primary key,
word varchar(50) not null,
content_id integer not null foreign key);
create table content(
content_id integer not null primary key,
article blob sub_type 1);
There will be a simple search user interface, giving the user the ability
to search on any number of words, and indicating whether the results should
contain all of the words or any of the words. The query to return any of
the words is simple:
select
c.article
from
keyword k
join content c on (c.content_id = k.content_id)
where
k.word = 'firebird' or
k.word = 'database' or
k.word = 'search'
I'm looking for advice on how to implement the 'all words' query, where an
article from Content would be returned only if it contained all three words
from the sample above.
tia,
Bob M..
associated with a row of a table. The row will contain a blob which will
be used to store a document or an email message ('article'). The user will
be able to run a query, searching for articles that contain a number of
keywords. The table structure will look something like this:
create table keyword(
keyword_id integer not null primary key,
word varchar(50) not null,
content_id integer not null foreign key);
create table content(
content_id integer not null primary key,
article blob sub_type 1);
There will be a simple search user interface, giving the user the ability
to search on any number of words, and indicating whether the results should
contain all of the words or any of the words. The query to return any of
the words is simple:
select
c.article
from
keyword k
join content c on (c.content_id = k.content_id)
where
k.word = 'firebird' or
k.word = 'database' or
k.word = 'search'
I'm looking for advice on how to implement the 'all words' query, where an
article from Content would be returned only if it contained all three words
from the sample above.
tia,
Bob M..