2011-09-05 101 views
4

我加入這些領域的時候我存儲在Lucene的數據:Zend的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); 

,但它不工作...

+0

好的,我發現了一個解決方案,使用'type:(a)OR type:(b)'etc .. – Alex

+3

請您考慮將您的評論作爲實際答案嗎?這是[自行確定](http://meta.stackexchange.com/questions/12513/should-i-not-answer-my-own-questions/12519#12519)你自己的問題。如果問題真的仍然沒有得到答覆,這將有助於保持「未答覆」清單^^ –

回答

5

那麼我的解決辦法是:

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

,它也是確定它寫像這個(分組字段):

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