[PHP] matching search terms

2004-09-13 Thread Jed R. Brubaker
Hi all.

I was wondering if any of you have experience with searching through a 
database for user provided search terms.

I was hoping that maybe I could get some insight into how to better approach 
what I am doing. Are there any great articles or example classes that I 
could look at? Please let me know!

As of right now, my architecture is to have a primary class, Search, which 
connects to the database, takes search terms, removes junk wordsand 
suffixes (s, ing, etc.)  (both defined by an array).

The class runs a query on each word for each field that the class is told to 
search, and based on the relevance of that field (as supplied to the 
class), points are awarded to returned items. If they come up again on 
searches for other words, they get more points.

Using that base architecture, I then extend the class (e.g. class Faq 
extends Search) and define word groups in the subclass. Word groups act to 
broaden the search words in a thesarus like fashion (when the search term 
dvd comes up, movie, title, video, etc. are added to the SQL query 
via OR). This way each subclass can define it's own set of word groups 
applicable for that usage.

The problem I am having is that far too many irrelevant items are coming up. 
When is my package coming? for example returns all kinds of junk because 
when is everywhere in a Faq.

I am hoping that there is some internet resource that has a variety of 
tricks and rules to throw into a search architecture, but I am also 
interested to see if anyone can give me some of their personal experience 
and expertise.

Thanks in advance! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] matching search terms

2004-09-13 Thread Jay Blanchard
[snip]
I am hoping that there is some internet resource 
[/snip]

Which begs the question, have you STFW?

http://www.google.com/search?q=search+functionhl=enlr=ie=UTF-8start=
10sa=N

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php