mysql - Fulltext search fields and Doctrine 2 -


we're using doctrine 2 , have simple search requirements in we'd set fulltext on field. i've had google around , seems there no way doctrine.

we're using zend framework 2 project , wondered if had ideas of workaround?

i don't think using lots of likes in query yeild fast enough search results, think @ same time using solr or elastic search way overkill searching 1 field in simple manner.

any suggestions? feeling we're going have hack together. @ moment we're creating database running orm:schema:create tool command line.

any suggestions?

simply said, there no solution if stick doctrine2 and don't want use queries and don't want introduce search engine.

doctrine2 relies on innodb , innodb (currently) not support fulltext. focusing on fulltext or queries no option i'd say. however, there simpler way using solr or elasticsearch, both using lucene engine. can create lucene index on file system (within project dir) , use zendsearch indexing , querying.

require zendframework/zendsearch via composer , search:

use zendsearch\lucene\lucene; use zendsearch\lucene\document; use zendsearch\lucene\document\field;  // relative project /var/www/site/data/search $dir = 'data/search';  // create index lucene::create($dir);  // insert new document $index = lucene::open($dir); $doc   = new document;  $doc->addfield(field::keyword('foo', 'bar')); $index->adddocument($doc);  // search index $index  = lucene::open($dir); $result = $index->query('foo:bar');  echo count($result); 

there no need install binary on server (like solr , elasticsearch) support search. it's faster fulltext search, have keep index up2date of course support proper search.


Comments