我在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)";