Doctrine Searchable Behavior vs Zend Lucene in sym

2019-07-15 02:34发布

问题:

I need to search for keywords in 2 table, simple thing

I am undecided about using one or the other? any suggestion performance wise?

Thanks!

回答1:

As cuhuak mentioned, Lucene is a fulltext search. Since it is written in Java, you additionaly need a Java Server (Tomcat for example). If you don't want an additional server, the Zend Lucene implementation (as noted in the comments by Matt Gibson) may also be worth looking into. With an additional server and if you only have a small host, this MAY not be good performance wise. Also, Lucene needs much more configuration and set-up than the Doctrine solutions.

On the performance side of things: Lucene is built to index millions of words and search within these in milliseconds. With millions of words in your "regular" RDBMS, things will get slow. You could set up a fulltextsearch in the database too, but this again needs setup and knowledge what to do.

So a generall thought: if the site is small (in terms of things to searc), go with the Doctrine approach, if you plan to get serious amounts of data, go with Lucene.



回答2:

Lucene has been developed for fulltext search. Do you need this functionality?

If you need only keywords functionality use Searchable Searchable is easer to use than Lucene.

Also consider to use sfDoctrineActAsTaggablePlugin