Zend Lucene查询

Ale*_*lex 4 php lucene zend-search-lucene

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

$index->addField(Zend_Search_Lucene_Field::Keyword('id', $entry->id));
$index->addField(Zend_Search_Lucene_Field::Keyword('type', $entry->type));
Run Code Online (Sandbox Code Playgroud)

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

我试过了:

 $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);
Run Code Online (Sandbox Code Playgroud)

但它不起作用......

Ale*_*lex 5

我的解决方案是:

$query = "type:(a) OR type:(b)";

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

$query = "type:(a OR b)";