Click here to Skip to main content
15,915,094 members
Home / Discussions / Database
   

Database

 
GeneralRe: Index of item in subquery Pin
Addabis21-May-03 19:45
Addabis21-May-03 19:45 
GeneralDataRow cast problem Pin
Andy H21-May-03 1:00
Andy H21-May-03 1:00 
GeneralRe: DataRow cast problem Pin
Arjan Einbu21-May-03 2:37
Arjan Einbu21-May-03 2:37 
GeneralRe: DataRow cast problem Pin
Andy H21-May-03 3:12
Andy H21-May-03 3:12 
GeneralDataset Diff - Pin
jmwalke120-May-03 14:22
jmwalke120-May-03 14:22 
GeneralParamaterized Queries Pin
David Salter20-May-03 11:22
David Salter20-May-03 11:22 
GeneralADO help pls Pin
BlackRider20-May-03 5:16
BlackRider20-May-03 5:16 
GeneralAttn: sql gurus, help! Pin
Member 9619-May-03 12:38
Member 9619-May-03 12:38 
Hello, I need to work out what seems to be a pretty advanced query for SQL server and despite a lot of books and all the internet, I can't seem to classify this into an easily searchable-for problem to get a handle on it. Any help classifying this would be appreciated:

I am making an interface for quickly searching a database of text documents. I've already done the indexing part (sucking out the unique words etc), it's the searching part that I need to refine.

I have three tables involved:

The first "documents" is a table that contains many plain text documents and each document has a unique identifier.

The second table "srchdict" one is a dictionary index containing two columns, a list of unique words culled from the documents to be searched and a unique identifier column to uniquely identify each word.

The third table is the key between the "srchdict" and the "documents" and is called "srchkey". It contains two columns: each one is a unique identifier, one column is the id from the dictionary table of each unique word found in a document and the other is a unique identifier that indicates which document that word was found in.

So far so good and no problem populating those tables at all.

Here is the problem, without resorting to doing a whole bunch of multiple queries in code (i.e. I want to do it all at the SQL server), is there a way (stored procedure or single query) to pass in a list of words that are being searched for, and return a list of document ID's of documents that only contain *all* the words in the list.

I've done this before in c++ with an Access database and it involved querying for each word separately, and storing the resulting list of matched document id's in another temporary table until the list of search words was exhausted, then querying the temporary results table to pull out only the duplicate document ID's that appear as many times over as the number of search terms (this ensures that only documents that match *all* search words appear in the results, any that do not match all are discarded).

Any help, either along the lines of "that's the only way to do it" or just a classification of what type of query algorithm etc this is would be tremendously appreceated.
GeneralRe: Attn: sql gurus, help! Pin
andyharman19-May-03 13:58
professionalandyharman19-May-03 13:58 
GeneralRe: Attn: sql gurus, help! Pin
Member 9619-May-03 16:41
Member 9619-May-03 16:41 
GeneralRe: Attn: sql gurus, help! Pin
Member 9620-May-03 5:15
Member 9620-May-03 5:15 
GeneralRe: Attn: sql gurus, help! Pin
Anonymous25-May-03 14:26
Anonymous25-May-03 14:26 
GeneralMostly working stored procedure revised Pin
Mike Osbahr19-May-03 11:09
Mike Osbahr19-May-03 11:09 
GeneralClarification Pin
Mike Osbahr19-May-03 16:18
Mike Osbahr19-May-03 16:18 
GeneralDesign Question Pin
Mark Sanders18-May-03 9:33
Mark Sanders18-May-03 9:33 
GeneralRe: Design Question Pin
Jeremy Oldham19-May-03 3:42
Jeremy Oldham19-May-03 3:42 
Generalcollation , locale ID Pin
Hesham Amin16-May-03 5:36
Hesham Amin16-May-03 5:36 
GeneralGot it !! Pin
Hesham Amin16-May-03 21:23
Hesham Amin16-May-03 21:23 
GeneralInstalling MSDE question Pin
DxSolo16-May-03 5:02
DxSolo16-May-03 5:02 
GeneralRe: Installing MSDE question Pin
Wayne Phipps16-May-03 21:58
Wayne Phipps16-May-03 21:58 
QuestionDatabase create code problem with deskop sql 2000? Pin
Bart-Man15-May-03 10:31
Bart-Man15-May-03 10:31 
AnswerSOLUTION Pin
Bart-Man16-May-03 5:29
Bart-Man16-May-03 5:29 
GeneralFetching Text ado.net(OLEDB) from sysbase DB Pin
vnagaraj14-May-03 8:26
vnagaraj14-May-03 8:26 
QuestionSSN Format Query? Pin
Steven Behnke14-May-03 7:03
Steven Behnke14-May-03 7:03 
Questionindependent Recordset ? Pin
AndreasSaurwein14-May-03 5:19
sussAndreasSaurwein14-May-03 5:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.