Re: Live Search

From: Date: Mon, 30 Nov 2009 23:33:20 +0000
Subject: Re: Live Search
References: 1 2 3 4 5 6 7  Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-6652@lists.php.net to get a copy of this message
On Mon, 30 Nov 2009 11:05:14 +0100, Hannes Magnusson <hannes.magnusson@gmail.com> wrote: > > As far as I know then the database created by sqlite2 is incompatible > with sqlite3, so PhD probably will have to create both variants :( Hi Hannes, I am running into a couple of problems with the sqlite search. I was hoping you could help. 1. Scoring The quickref.php code has a neat trick for scoring results based on where the keyword appears in the function/class name. I don't see any obvious way to get the same effect through an sqlite query given it's limited string functions. For queries that don't directly match, the quickref.php script uses the similar_text() function to calculate the similarity between the keyword and the function/class name. The similar_text function produces a similarity percentage which we can use to rank results by 'relevance' and weed out poor matches. I don't see any clear way to achieve the same effect with metaphone. Actually, the metaphone matching is presently disabled in manual-lookup.inc (line 135) with a "FIXME" citing too many false positives. 2. Performance On my laptop, the sqlite script is taking 90ms to produce the list of all functions/classes that match my query (e.g. 'sub') for a given language (e.g. 'en'). The SQL looks like this: SELECT name FROM fs WHERE lang='en' AND keywords LIKE '%sub%'; I think the relative slowness is due to the size of manual-lookup.sqlite. It weighs in at 28MB, whereas the function cache I was using before is around 400KB. Any ideas? Thanks! Stew

« previous php.webmaster (#6652) next »