Building a Simple Search Engine with PHP
Subject:   RE: A more detailed query...
Date:   2003-12-23 08:12:37
From:   anonymous2
Response to: RE: A more detailed query...

Let me try to explain a little more clearly.

Say I have an article with the word "science" and the word "computer" in it, and the search asked for all articles with "science" but without "computer."

If I use this query:

w2.word_word != "computer"

than it will look for an occurance o2 that dosn't point to "computer". However, this constraint would be satisfied instantly by any other word existing in the article - even the word "science" would satisfy it. As long as there is one instance of a word other than computer in that article, the search will bring it up.

If I put the "!= " further up with the article definition, we still get a similar problem:

p.page_id != o1.page_id

This occurrence o1 of "computer" may indeed not be in the page, simply because it is an occurrence of "computer" on another page. As long as there is any other page with "computer" on it, the query will bring up the page that the search dosn't work.

What I really want is not:

"Find a page where there EXISTS a word "computer" not on that page"


"Find a page that, for ALL occurrences of the word "computer", NONE of them are on it"