Here are my search engine woes again...
Ok, i've got a word lookup table, so that searching for a word will retrieve the word's id, and then search another table to find occurences of the id and the matching page reference. i.e.
SELECT page_ref
FROM pages
WHERE pages.page_id IN (SELECT id
FROM word_lookup
WHERE word IN ('word1', 'word2', 'etc'));
That's a simplified version of what i've got. However, I want a user to be able to search for a phrase, e.g. "Minority Report". I know how to make this one string in php, but i don't know how to search the database for it. If i have a table with a column (word_pos) showing the position of every word in every document (which i already have) how can i select those entries where the word_pos for "Report" is one value higher than the word_pos for "Minority", if i don't know the word_pos of Minority in the first place? I really only want to make one query on the database. Hope all this makes sense.
Thanks.