For other field
names you can do this:
$hits = $index->find($query);
foreach ($hits as $hit) {
// Get 'title' document field
$title = $hit->title;
But to retrieve the a field called id, you have to do:
$id = $hit->getDocument()->id;
This is only required for the fieldnames called id and score, so it??™s best to use different names, such as
doc_id and doc_score.
Secondly, you need to be aware of memory usage. Zend_Search_Lucene uses a lot of memory! The
memory usage increases if you have a lot of unique terms which occurs if you have a lot of untokenised phases
as field values. This means that you are indexing a lot of non-text data. From a practical point of view, this
means that Zend_Search_Lucene works best for searching text which isn??™t a problem for most websites! Note
that indexing uses a bit more memory too, and can be controlled using the MaxBufferedDocs parameter.
Further details are in the main Zend Framework manual.
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
Lastly, Zend_Search_Lucene uses UTF-8 character coding internally and if you are indexing non-ascii
data, it is wise to specify the encoding of the data fields when adding to the index.
Pages:
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224