Zend Lucene查询

4

当我存储数据到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);

但它不起作用...


好的,我找到了一个解决方案,使用 type:(a) OR type:(b) 等等。 - Alex
3
请问您能否考虑将您的评论作为实际答案发布呢?自我回答是被允许的。这也有助于保持“未回答”列表中真正未得到解答的问题的清晰。^^ - Jürgen Thelen
1个回答

5
我的解决方案是: $query = "type:(a) OR type:(b)";
也可以这样写(字段分组): $query = "type:(a OR b)";

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接