编程语言
首页 > 编程语言> > php – Zend Lucene查询

php – Zend Lucene查询

作者:互联网

我在Lucene中存储数据时添加这些字段:

$index->addField(Zend_Search_Lucene_Field::Keyword('id', $entry->id));
$index->addField(Zend_Search_Lucene_Field::Keyword('type', $entry->type));

如何使查询只检索具有特定类型的数据?

我试过了:

 $query = "type IN ('a', 'b', 'c')"; // get data that has either of these types
 $this->query->addSubquery(Zend_Search_Lucene_Search_QueryParser::parse($query), true);

但它不起作用……

解决方法:

我的解决方案是:

$query =“type:(a)OR type:(b)”;

也可以这样写(字段分组):

$query =“type:(a OR b)”;

标签:php,lucene,zend-search-lucene
来源: https://codeday.me/bug/20190621/1253300.html