> Hello smart people,
> 
> My question is:
> 
> Is this three stage action possible with one SQL statement?
> 


Yes you can do a query like:

select books.title from
words as w1,words as w2, wordlinks as v1,wordlinks as v2,books
WHERE (w1.WordNumber =v1.WordNumber ) AND (w2.WordNumber =v2.WordNumber
) 
AND   (books.BookNumber  = v1.BookNumber ) AND
(titel.BookNumber=v2.BookNumber) 
AND   (w1.word = 'Finn') AND w2.word = 'Huckleberry';

As you see the query get complexer with every word you add. In my
expirience the query gets very slow if you ask for more then 6 words. So
i restrict my searches to not more than 6 words. It depends how often a
word is mentioned in the wordlinks table, if you hit two words or more
words with many rows in wordlinks, the query becomes slow. So it also
depends on how good you filter out the noise words in your database, and
also in your query....

In my application i check the number of links a word has before, and if
it is more then 2000 i delete the word from the search. (my words as a
column count, which holds the number of wordlinks it is in)

Because of this i use in some applications the fulltext index of mysql:

SELECT
 DISTINCT books.title from titel";
 WHERE match(titel) against ('huckelberry finn')";

But fulltext index behaves different than the reverse index. The major
thing is that it only indexes words longer than 3 Characters. So if you
search for "Lee" you would get no result (see
http://www.mysql.com/doc/M/y/MySQL_full-text_search.html )

-------------------------------------------------------------------
Wim Bonis             ,+'^'+,                 Telefon:0631-31662-0
          Internet Solution Service GmbH      Technik:0631-31662-15
                       +,.,+                   privat:0631-36071-80
email: [EMAIL PROTECTED]               67655 Kaiserslautern
Karl-Marx-Str. 13                              --== DPN-POP KL ==--

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to