Re: Counting keywords in database record

From: Date: Sun, 12 Nov 2000 10:42:43 +0000
Subject: Re: Counting keywords in database record
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24851@lists.php.net to get a copy of this message
> field on the search page, and then my PHP script selects all rows from the DB > where that keyword appears in any of the fields. I'd like to be able to count > the number of times the keyword appears in each row, and then sort the search Hello .. i believe the right way to do this is a complete indexing of your content based on the words that appair in either field. what i mean by this is.. you parse all your content for separate words and list them in a table .. it will not grow more than say.. 10000 records (how many words are there in english? :) ) then create a table to reference documents and keywords.. so you know which word is where.. you end up with a large table but you can of course trim it down a lot if you exclode common words , articles etc.. the point is the keyword table grows logaritmically (kind of.. ) with the document number.. while the reference database grows linearly wih the document indexed.. at this point you can performe extremely quick queries and know how many times it appaired in that document also. (wont get into details on this but should be easy.). I believe this is the way large search engine works of course.. corrections, additions anyone? Giovanni Tummarello tummarel@ascu.unian.it Fight Spam! Join CAUCE (Coalition Against Unsolicited Commercial Email) at http://www.cauce.org/ and tell your Congresspeople how Spam mailings hurt you. Help protect genuine Internet commerce: Outlaw UCE Spamming.

« previous php.general (#24851) next »