【问题标题】:Zend Lucene queryZend Lucene 查询
【发布时间】:2011-09-05 15:42:35
【问题描述】:

我在 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)等的解决方案。
  • 您是否考虑将您的评论作为实际答案?这是OK to self-answer您自己的问题。这将有助于保持“未回答”列表中的问题仍然没有回答^^

标签: php lucene zend-search-lucene


【解决方案1】:

我的解决方案是:

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

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

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

【讨论】:

    猜你喜欢
    • 2011-07-07
    • 1970-01-01
    • 2011-03-28
    • 2011-04-11
    • 2010-11-13
    • 1970-01-01
    • 2010-11-06
    • 2010-11-18
    • 2013-04-30
    相关资源
    最近更新 更多