简体   繁体   English

如何用学说进行全文搜索?

[英]How to do fulltext search with doctrine?

WHERE column = value    ->add(column, value);
WHERE column <> value   ->add(column, value, Criteria::NOT_EQUAL);
Other Comparison Operators  
> , <   Criteria::GREATER_THAN, Criteria::LESS_THAN
>=, <=  Criteria::GREATER_EQUAL, Criteria::LESS_EQUAL
IS NULL, IS NOT NULL    Criteria::ISNULL, Criteria::ISNOTNULL
LIKE, ILIKE     Criteria::LIKE, Criteria::ILIKE
IN, NOT IN  Criteria::IN, Criteria::NOT_IN
Other SQL Keywords  
ORDER BY column ASC     ->addAscendingOrderByColumn(column);
ORDER BY column DESC    ->addDescendingOrderByColumn(column);
LIMIT limit     ->setLimit(limit)
OFFSET offset   ->setOffset(offset)
FROM table1, table2 WHERE table1.col1 = table2.col2     ->addJoin(col1, col2)
FROM table1 LEFT JOIN table2 ON table1.col1 = table2.col2   ->addJoin(col1, col2, Criteria::LEFT_JOIN)
FROM table1 RIGHT JOIN table2 ON table1.col1 = table2.col2  ->addJoin(col1, col2, Criteria::RIGHT_JOIN)

The above are all basic operations,what's the equivalent for fulltext search? 以上都是基本操作,全文搜索的等价物是什么?

The Doctrine documentation about Searching describes this pretty well. 关于搜索的Doctrine文档很好地描述了这一点。

Wrap up: 包起来:

  • You have to add the behavior Searchable to your model definition and configure which fields should be indexed. 您必须将行为Searchable添加到模型定义中并配置应编入索引的字段。
  • You might have to set up some other stuff that is explained in the documentation. 您可能必须设置文档中说明的其他一些内容。
  • You can perform a search with search , eg: 您可以使用search执行search ,例如:

     $newsItemTable = Doctrine_Core::getTable('NewsItem'); $results = $newsItemTable->search('test'); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM