我有我想搜索的 4 字段女巫表。我像这样索引字段:
$doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));
$doc->addField(Zend_Search_Lucene_Field::UnStored('username', $this->getUsername(), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnStored('firstName', $this->getFirstName(), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnStored('lastName', $this->getLastName(), 'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::UnStored('city', $this->getCity(), 'utf-8'));
我想使用表单选项单独搜索此字段。
<select name="contact[subject]" id="contact_subject">
<option value="0">Username</option>
<option value="1">First Name</option>
<option value="2">Last Name</option>
<option value="3">City</option>
</select>
如何告诉 Lucene 仅在我想要的字段中搜索结果?我读了很多问题和解释,但我不明白:(