"If users commonly search 'product names' you may want to make that
field a FULLTEXT index. This will make searches much faster."
Have you verified this? Using a fulltext index requires the "MATCHES"
function in the SQL, it doesn't get used if you do a "WHERE foo=" type
query. I don't see any code in CakePHP that uses the MATCHES function.
I think it may have been referring to the use of LIKE queries compared to FULLTEXT queries. And to that, I'm not sure which is faster although I assume the latter. It may be interesting to look at Lucene. (btw: a CakePHP implementation of Lucene would be awesome.)
On Tue, Jun 10, 2008 at 12:33 PM, SeanW <swalb...@gmail.com> wrote:
> "If users commonly search 'product names' you may want to make that > field a FULLTEXT index. This will make searches much faster."
> Have you verified this? Using a fulltext index requires the "MATCHES" > function in the SQL, it doesn't get used if you do a "WHERE foo=" type > query. I don't see any code in CakePHP that uses the MATCHES function.
For custom searches i tend not to use Cake's queries, but build my
own. $this->Model->query($customSQL);
For searched I use a FULLTEXT matches, as appose to LIKE. In the
simple tests I ran this was usually faster. Though the numbers
varied, I decided to use this method instead.
Sean is absolutely right though, using cakes query calls will not
likely show any increase in performance.
Hey, I don't think that a cake implementation is needed Zend_Search_Lucene is awesome, and it doesn't have any dependencies from Zend Framework. I'm building(finishing) a behavior wraping Zend_Search_Lucene + a console tool for index generation (primary for cookbook) its still alpha but it works. it will be released soon.
As for the comparison - i planed to do some but with my basic tests - it outperforms Mysql FULLTEXT couple times. ( LIKE %a% is way slower) than FULLTEXT.
> I think it may have been referring to the use of LIKE queries compared > to FULLTEXT queries. And to that, I'm not sure which is faster > although I assume the latter. It may be interesting to look at Lucene. > (btw: a CakePHP implementation of Lucene would be awesome.)
> On Tue, Jun 10, 2008 at 12:33 PM, SeanW <swalb...@gmail.com> wrote:
>> "If users commonly search 'product names' you may want to make that >> field a FULLTEXT index. This will make searches much faster."
>> Have you verified this? Using a fulltext index requires the "MATCHES" >> function in the SQL, it doesn't get used if you do a "WHERE foo=" type >> query. I don't see any code in CakePHP that uses the MATCHES function.
On Tue, Jun 10, 2008 at 3:21 PM, Marcin Domanski <tram...@gmail.com> wrote: > I don't think that a cake implementation is needed Zend_Search_Lucene > is awesome, and it doesn't have any dependencies from Zend Framework.
I wasn't sure but that's great to know. It's be great to see a model behavior for this that would automatically create lucene documents for every record and then maybe a search method that would allow records to be retrieved. actsAs Lucene would be very nice. (and if you have such a thing already, I'd love to see it :) )
On Tue, Jun 10, 2008 at 3:21 PM, Marcin Domanski <tram...@gmail.com> wrote: > I don't think that a cake implementation is needed Zend_Search_Lucene > is awesome, and it doesn't have any dependencies from Zend Framework.
I wasn't sure but that's great to know. It's be great to see a model behavior for this that would automatically create lucene documents for every record and then maybe a search method that would allow records to be retrieved. actsAs Lucene would be very nice. (and if you have such a thing already, I'd love to see it :) )
Jonathan Snook wrote: > On Tue, Jun 10, 2008 at 3:21 PM, Marcin Domanski <tram...@gmail.com> wrote:
>> I don't think that a cake implementation is needed Zend_Search_Lucene >> is awesome, and it doesn't have any dependencies from Zend Framework.
> I wasn't sure but that's great to know. It's be great to see a model > behavior for this that would automatically create lucene documents for > every record and then maybe a search method that would allow records > to be retrieved. actsAs Lucene would be very nice. (and if you have > such a thing already, I'd love to see it :) )
-- Alain Veylit Application developer Claremont Colleges Digital Library The Libraries of the Claremont Colleges Claremont University Consortium 909-621-8013
On Jun 11, 3:01 am, "Jonathan Snook" <jonathan.sn...@gmail.com> wrote:
> I wasn't sure but that's great to know. It's be great to see a model
> behavior for this that would automatically create lucene documents for
> every record and then maybe a search method that would allow records
> to be retrieved. actsAs Lucene would be very nice. (and if you have
> such a thing already, I'd love to see it :) )
I have used Zend_Search _Lucene with cakePHP and it works great - but
I never figured out how to paginate the search results from Lucene
I have been toying with a actsAs FULLTEXT behavior
On Wed, Jun 11, 2008 at 6:21 AM, Dr. Tarique Sani <tariques...@gmail.com> wrote:
> On Jun 11, 3:01 am, "Jonathan Snook" <jonathan.sn...@gmail.com> wrote: >> I wasn't sure but that's great to know. It's be great to see a model >> behavior for this that would automatically create lucene documents for >> every record and then maybe a search method that would allow records >> to be retrieved. actsAs Lucene would be very nice. (and if you have >> such a thing already, I'd love to see it :) )
> I have used Zend_Search _Lucene with cakePHP and it works great - but > I never figured out how to paginate the search results from Lucene
One can't use the built in paginator cause it would need a seperate model with paginate and paginateCount . It's always an option...
I wasn't working on the paginating stuff yet but i think i just use the LimitIterator. From my benchamrks it's not really worth caching the results but cookbook doesn't have such a big dataset... so im not yet sure if i'll add caching.
Tarigue did you use Lucene as a crawler or as db search ?
About the current state: the console indexer/searcher is working the behavtior - searching is working (without pagination) Now i'm working on highlighting and limiting the text that is returned for the results.
On Wed, Jun 11, 2008 at 1:54 PM, Marcin Domanski <tram...@gmail.com> wrote: > From my benchamrks it's not really worth caching the results but > cookbook doesn't have such a big dataset... so im not yet sure if i'll > add caching.
Caching in most cases will not be needed... Lucene was meant to be very fast
> Tarigue did you use Lucene as a crawler or as db search ?
crawler
Tarique
-- ============================================================= Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com =============================================================
> On Wed, Jun 11, 2008 at 1:54 PM, Marcin Domanski <tram...@gmail.com> wrote:
> > From my benchamrks it's not really worth caching the results but
> > cookbook doesn't have such a big dataset... so im not yet sure if i'll
> > add caching.
> Caching in most cases will not be needed... Lucene was meant to be very fast
> > Tarigue did you use Lucene as a crawler or as db search ?
Or, you could use the now built-in (1.2) Containable behaviour. I used
to use a lot of unbindModel calls, but on a recent project started
using Containable and it's much cleaner and easier.
On Jun 11, 7:09 pm, RichardAtHome <richardath...@gmail.com> wrote:
> The biggest performance improvement I've found so far is:
> Unbind unused models! Simple, but very effective.
> For example, a few pages in a project I'm working on needed deep
> recursion (recursive = 3), which resulted in 4000+ queries O.o
> The pages were timing out.
> A few unbinds later and its down to 40+ queries.
> Unbinding also has the added benefit of using less memory per request
> too meaning your apps are the little bit more scalable.
> On Jun 11, 9:56 am, "Dr. Tarique Sani" <tariques...@gmail.com> wrote:
> > On Wed, Jun 11, 2008 at 1:54 PM, Marcin Domanski <tram...@gmail.com> wrote:
> > > From my benchamrks it's not really worth caching the results but
> > > cookbook doesn't have such a big dataset... so im not yet sure if i'll
> > > add caching.
> > Caching in most cases will not be needed... Lucene was meant to be very fast
> > > Tarigue did you use Lucene as a crawler or as db search ?