Building a Simple Search Engine with PHP
Subject:   RE: A more detailed query...
Date:   2003-12-23 07:15:55
From:   dsolin
Response to: A more detailed query...

Hi Giff,

I'm not sure if I got you right here, but couldn't you just use the != or NOT LIKE operators? This would result in something like:

w2.word_word != \"$keyword[1]\"


w2.word_word NOT LIKE \"$keyword[1]\"

Hope that helps!


Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • RE: A more detailed query...
    2003-12-23 07:44:06  anonymous2 [View]

    I tried that earlier, but it doesn't seem to work - the reason being (I think) that there ARE occurances of that word that are defined as not being in that article (aka, all the occurances in other articles).
    • RE: A more detailed query...
      2003-12-23 08:12:37  anonymous2 [View]

      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"