Zend_Search_Lucene-Overview.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.search.lucene.overview">
  4. <title>Overview</title>
  5. <sect2 id="zend.search.lucene.introduction">
  6. <title>Introduction</title>
  7. <para>
  8. <classname>Zend_Search_Lucene</classname> is a general purpose text search engine
  9. written entirely in <acronym>PHP</acronym> 5. Since it stores its index on the
  10. filesystem and does not require a database server, it can add search capabilities to
  11. almost any <acronym>PHP</acronym>-driven website.
  12. <classname>Zend_Search_Lucene</classname> supports the following features:
  13. <itemizedlist>
  14. <listitem>
  15. <para>Ranked searching - best results returned first</para>
  16. </listitem>
  17. <listitem>
  18. <para>
  19. Many powerful query types: phrase queries, boolean queries, wildcard queries,
  20. proximity queries, range queries and many others.
  21. </para>
  22. </listitem>
  23. <listitem>
  24. <para>Search by specific field (e.g., title, author, contents)</para>
  25. </listitem>
  26. </itemizedlist>
  27. <classname>Zend_Search_Lucene</classname> was derived from the Apache Lucene project.
  28. The currently (starting from ZF 1.6) supported Lucene index format versions are 1.4 -
  29. 2.3. For more information on Lucene, visit <ulink
  30. url="http://lucene.apache.org/java/docs/"/>.
  31. </para>
  32. <note>
  33. <title/>
  34. <para>
  35. Previous <classname>Zend_Search_Lucene</classname> implementations support the
  36. Lucene 1.4 (1.9) - 2.1 index formats.
  37. </para>
  38. <para>
  39. Starting from Zend Framework 1.5 any index created using pre-2.1 index format is
  40. automatically upgraded to Lucene 2.1 format after the
  41. <classname>Zend_Search_Lucene</classname> update and will not be compatible with
  42. <classname>Zend_Search_Lucene</classname> implementations included into Zend
  43. Framework 1.0.x.
  44. </para>
  45. </note>
  46. </sect2>
  47. <sect2 id="zend.search.lucene.index-creation.documents-and-fields">
  48. <title>Document and Field Objects</title>
  49. <para>
  50. <classname>Zend_Search_Lucene</classname> operates with documents as atomic objects for
  51. indexing. A document is divided into named fields, and fields have content that can be
  52. searched.
  53. </para>
  54. <para>
  55. A document is represented by the <classname>Zend_Search_Lucene_Document</classname>
  56. class, and this objects of this class contain instances of
  57. <classname>Zend_Search_Lucene_Field</classname> that represent the fields on the
  58. document.
  59. </para>
  60. <para>
  61. It is important to note that any information can be added to the index.
  62. Application-specific information or metadata can be stored in the document
  63. fields, and later retrieved with the document during search.
  64. </para>
  65. <para>
  66. It is the responsibility of your application to control the indexer.
  67. This means that data can be indexed from any source
  68. that is accessible by your application. For example, this could be the
  69. filesystem, a database, an HTML form, etc.
  70. </para>
  71. <para>
  72. <classname>Zend_Search_Lucene_Field</classname> class provides several static methods to
  73. create fields with different characteristics:
  74. </para>
  75. <programlisting language="php"><![CDATA[
  76. $doc = new Zend_Search_Lucene_Document();
  77. // Field is not tokenized, but is indexed and stored within the index.
  78. // Stored fields can be retrived from the index.
  79. $doc->addField(Zend_Search_Lucene_Field::Keyword('doctype',
  80. 'autogenerated'));
  81. // Field is not tokenized nor indexed, but is stored in the index.
  82. $doc->addField(Zend_Search_Lucene_Field::UnIndexed('created',
  83. time()));
  84. // Binary String valued Field that is not tokenized nor indexed,
  85. // but is stored in the index.
  86. $doc->addField(Zend_Search_Lucene_Field::Binary('icon',
  87. $iconData));
  88. // Field is tokenized and indexed, and is stored in the index.
  89. $doc->addField(Zend_Search_Lucene_Field::Text('annotation',
  90. 'Document annotation text'));
  91. // Field is tokenized and indexed, but is not stored in the index.
  92. $doc->addField(Zend_Search_Lucene_Field::UnStored('contents',
  93. 'My document content'));
  94. ]]></programlisting>
  95. <para>
  96. Each of these methods (excluding the
  97. <methodname>Zend_Search_Lucene_Field::Binary()</methodname> method) has an optional
  98. <varname>$encoding</varname> parameter for specifying input data encoding.
  99. </para>
  100. <para>
  101. Encoding may differ for different documents as well as for different fields within one
  102. document:
  103. <programlisting language="php"><![CDATA[
  104. $doc = new Zend_Search_Lucene_Document();
  105. $doc->addField(Zend_Search_Lucene_Field::Text('title',
  106. $title,
  107. 'iso-8859-1'));
  108. $doc->addField(Zend_Search_Lucene_Field::UnStored('contents',
  109. $contents,
  110. 'utf-8'));
  111. ]]></programlisting>
  112. </para>
  113. <para>
  114. If encoding parameter is omitted, then the current locale is used at processing time.
  115. For example:
  116. <programlisting language="php"><![CDATA[
  117. setlocale(LC_ALL, 'de_DE.iso-8859-1');
  118. ...
  119. $doc->addField(Zend_Search_Lucene_Field::UnStored('contents', $contents));
  120. ]]></programlisting>
  121. </para>
  122. <para>
  123. Fields are always stored and returned from the index in UTF-8 encoding. Any required
  124. conversion to UTF-8 happens automatically.
  125. </para>
  126. <para>
  127. Text analyzers (<link linkend="zend.search.lucene.extending.analysis">see below</link>)
  128. may also convert text to some other encodings. Actually, the default analyzer converts
  129. text to 'ASCII//TRANSLIT' encoding. Be careful, however; this translation may depend on
  130. current locale.
  131. </para>
  132. <para>
  133. Fields' names are defined at your discretion in the <methodname>addField()</methodname>
  134. method.
  135. </para>
  136. <para>
  137. Java Lucene uses the 'contents' field as a default field to search.
  138. <classname>Zend_Search_Lucene</classname> searches through all fields by default, but
  139. the behavior is configurable. See the <link
  140. linkend="zend.search.lucene.query-language.fields">"Default search field"</link>
  141. chapter for details.
  142. </para>
  143. </sect2>
  144. <sect2 id="zend.search.lucene.index-creation.understanding-field-types">
  145. <title>Understanding Field Types</title>
  146. <itemizedlist>
  147. <listitem>
  148. <para>
  149. <code>Keyword</code> fields are stored and indexed, meaning that they can be
  150. searched as well as displayed in search results. They are not split up into
  151. separate words by tokenization. Enumerated database fields usually translate
  152. well to Keyword fields in <classname>Zend_Search_Lucene</classname>.
  153. </para>
  154. </listitem>
  155. <listitem>
  156. <para>
  157. <code>UnIndexed</code> fields are not searchable, but they are returned with
  158. search hits. Database timestamps, primary keys, file system paths, and other
  159. external identifiers are good candidates for UnIndexed fields.
  160. </para>
  161. </listitem>
  162. <listitem>
  163. <para>
  164. <code>Binary</code> fields are not tokenized or indexed, but are stored for
  165. retrieval with search hits. They can be used to store any data encoded as a
  166. binary string, such as an image icon.
  167. </para>
  168. </listitem>
  169. <listitem>
  170. <para>
  171. <code>Text</code> fields are stored, indexed, and tokenized. Text fields are
  172. appropriate for storing information like subjects and titles that need to be
  173. searchable as well as returned with search results.
  174. </para>
  175. </listitem>
  176. <listitem>
  177. <para>
  178. <code>UnStored</code> fields are tokenized and indexed, but not stored in the
  179. index. Large amounts of text are best indexed using this type of field. Storing
  180. data creates a larger index on disk, so if you need to search but not redisplay
  181. the data, use an UnStored field. UnStored fields are practical when using a
  182. <classname>Zend_Search_Lucene</classname> index in combination with a relational
  183. database. You can index large data fields with UnStored fields for searching,
  184. and retrieve them from your relational database by using a separate field as an
  185. identifier.
  186. </para>
  187. <table id="zend.search.lucene.index-creation.understanding-field-types.table">
  188. <title>Zend_Search_Lucene_Field Types</title>
  189. <tgroup cols="5">
  190. <thead>
  191. <row>
  192. <entry>Field Type</entry>
  193. <entry>Stored</entry>
  194. <entry>Indexed</entry>
  195. <entry>Tokenized</entry>
  196. <entry>Binary</entry>
  197. </row>
  198. </thead>
  199. <tbody>
  200. <row>
  201. <entry>Keyword</entry>
  202. <entry>Yes</entry>
  203. <entry>Yes</entry>
  204. <entry>No</entry>
  205. <entry>No</entry>
  206. </row>
  207. <row>
  208. <entry>UnIndexed</entry>
  209. <entry>Yes</entry>
  210. <entry>No</entry>
  211. <entry>No</entry>
  212. <entry>No</entry>
  213. </row>
  214. <row>
  215. <entry>Binary</entry>
  216. <entry>Yes</entry>
  217. <entry>No</entry>
  218. <entry>No</entry>
  219. <entry>Yes</entry>
  220. </row>
  221. <row>
  222. <entry>Text</entry>
  223. <entry>Yes</entry>
  224. <entry>Yes</entry>
  225. <entry>Yes</entry>
  226. <entry>No</entry>
  227. </row>
  228. <row>
  229. <entry>UnStored</entry>
  230. <entry>No</entry>
  231. <entry>Yes</entry>
  232. <entry>Yes</entry>
  233. <entry>No</entry>
  234. </row>
  235. </tbody>
  236. </tgroup>
  237. </table>
  238. </listitem>
  239. </itemizedlist>
  240. </sect2>
  241. <sect2 id="zend.search.lucene.index-creation.html-documents">
  242. <title>HTML documents</title>
  243. <para>
  244. <classname>Zend_Search_Lucene</classname> offers a HTML parsing feature. Documents can
  245. be created directly from a HTML file or string:
  246. <programlisting language="php"><![CDATA[
  247. $doc = Zend_Search_Lucene_Document_Html::loadHTMLFile($filename);
  248. $index->addDocument($doc);
  249. ...
  250. $doc = Zend_Search_Lucene_Document_Html::loadHTML($htmlString);
  251. $index->addDocument($doc);
  252. ]]></programlisting>
  253. </para>
  254. <para>
  255. <classname>Zend_Search_Lucene_Document_Html</classname> class uses the
  256. <methodname>DOMDocument::loadHTML()</methodname> and
  257. <methodname>DOMDocument::loadHTMLFile()</methodname> methods to parse the source HTML,
  258. so it doesn't need HTML to be well formed or to be <acronym>XHTML</acronym>. On the
  259. other hand, it's sensitive to the encoding specified by the "meta http-equiv" header
  260. tag.
  261. </para>
  262. <para>
  263. <classname>Zend_Search_Lucene_Document_Html</classname> class recognizes document title,
  264. body and document header meta tags.
  265. </para>
  266. <para>
  267. The 'title' field is actually the /html/head/title value. It's stored within the index,
  268. tokenized and available for search.
  269. </para>
  270. <para>
  271. The 'body' field is the actual body content of the HTML file or string. It doesn't
  272. include scripts, comments or attributes.
  273. </para>
  274. <para>
  275. The <methodname>loadHTML()</methodname> and <methodname>loadHTMLFile()</methodname>
  276. methods of <classname>Zend_Search_Lucene_Document_Html</classname> class also have
  277. second optional argument. If it's set to <constant>TRUE</constant>, then body content is
  278. also stored within index and can be retrieved from the index. By default, the body is
  279. tokenized and indexed, but not stored.
  280. </para>
  281. <para>
  282. The third parameter of <methodname>loadHTML()</methodname> and
  283. <methodname>loadHTMLFile()</methodname> methods optionally specifies source HTML
  284. document encoding. It's used if encoding is not specified using Content-type HTTP-EQUIV
  285. meta tag.
  286. </para>
  287. <para>
  288. Other document header meta tags produce additional document fields. The field 'name' is
  289. taken from 'name' attribute, and the 'content' attribute populates the field 'value'.
  290. Both are tokenized, indexed and stored, so documents may be searched by their meta tags
  291. (for example, by keywords).
  292. </para>
  293. <para>
  294. Parsed documents may be augmented by the programmer with any other field:
  295. <programlisting language="php"><![CDATA[
  296. $doc = Zend_Search_Lucene_Document_Html::loadHTML($htmlString);
  297. $doc->addField(Zend_Search_Lucene_Field::UnIndexed('created',
  298. time()));
  299. $doc->addField(Zend_Search_Lucene_Field::UnIndexed('updated',
  300. time()));
  301. $doc->addField(Zend_Search_Lucene_Field::Text('annotation',
  302. 'Document annotation text'));
  303. $index->addDocument($doc);
  304. ]]></programlisting>
  305. </para>
  306. <para>
  307. Document links are not included in the generated document, but may be retrieved with
  308. the <methodname>Zend_Search_Lucene_Document_Html::getLinks()</methodname> and
  309. <methodname>Zend_Search_Lucene_Document_Html::getHeaderLinks()</methodname> methods:
  310. <programlisting language="php"><![CDATA[
  311. $doc = Zend_Search_Lucene_Document_Html::loadHTML($htmlString);
  312. $linksArray = $doc->getLinks();
  313. $headerLinksArray = $doc->getHeaderLinks();
  314. ]]></programlisting>
  315. </para>
  316. <para>
  317. Starting from Zend Framework 1.6 it's also possible to exclude links with
  318. <code>rel</code> attribute set to <code>'nofollow'</code>. Use
  319. <methodname>Zend_Search_Lucene_Document_Html::setExcludeNoFollowLinks($true)</methodname>
  320. to turn on this option.
  321. </para>
  322. <para>
  323. <methodname>Zend_Search_Lucene_Document_Html::getExcludeNoFollowLinks()</methodname>
  324. method returns current state of "Exclude nofollow links" flag.
  325. </para>
  326. </sect2>
  327. <sect2 id="zend.search.lucene.index-creation.docx-documents">
  328. <title>Word 2007 documents</title>
  329. <para>
  330. <classname>Zend_Search_Lucene</classname> offers a Word 2007 parsing feature. Documents
  331. can be created directly from a Word 2007 file:
  332. <programlisting language="php"><![CDATA[
  333. $doc = Zend_Search_Lucene_Document_Docx::loadDocxFile($filename);
  334. $index->addDocument($doc);
  335. ]]></programlisting>
  336. </para>
  337. <para>
  338. <classname>Zend_Search_Lucene_Document_Docx</classname> class uses the
  339. <code>ZipArchive</code> class and <code>simplexml</code> methods to parse the source
  340. document. If the <code>ZipArchive</code> class (from module php_zip) is not available,
  341. the <classname>Zend_Search_Lucene_Document_Docx</classname> will also not be available
  342. for use with Zend Framework.
  343. </para>
  344. <para>
  345. <classname>Zend_Search_Lucene_Document_Docx</classname> class recognizes document meta
  346. data and document text. Meta data consists, depending on document contents, of filename,
  347. title, subject, creator, keywords, description, lastModifiedBy, revision, modified,
  348. created.
  349. </para>
  350. <para>
  351. The 'filename' field is the actual Word 2007 file name.
  352. </para>
  353. <para>
  354. The 'title' field is the actual document title.
  355. </para>
  356. <para>
  357. The 'subject' field is the actual document subject.
  358. </para>
  359. <para>
  360. The 'creator' field is the actual document creator.
  361. </para>
  362. <para>
  363. The 'keywords' field contains the actual document keywords.
  364. </para>
  365. <para>
  366. The 'description' field is the actual document description.
  367. </para>
  368. <para>
  369. The 'lastModifiedBy' field is the username who has last modified the actual document.
  370. </para>
  371. <para>
  372. The 'revision' field is the actual document revision number.
  373. </para>
  374. <para>
  375. The 'modified' field is the actual document last modified date / time.
  376. </para>
  377. <para>
  378. The 'created' field is the actual document creation date / time.
  379. </para>
  380. <para>
  381. The 'body' field is the actual body content of the Word 2007 document. It only includes
  382. normal text, comments and revisions are not included.
  383. </para>
  384. <para>
  385. The <methodname>loadDocxFile()</methodname> methods of
  386. <classname>Zend_Search_Lucene_Document_Docx</classname> class also have second optional
  387. argument. If it's set to <constant>TRUE</constant>, then body content is also stored
  388. within index and can be retrieved from the index. By default, the body is tokenized and
  389. indexed, but not stored.
  390. </para>
  391. <para>
  392. Parsed documents may be augmented by the programmer with any other field:
  393. <programlisting language="php"><![CDATA[
  394. $doc = Zend_Search_Lucene_Document_Docx::loadDocxFile($filename);
  395. $doc->addField(Zend_Search_Lucene_Field::UnIndexed(
  396. 'indexTime',
  397. time())
  398. );
  399. $doc->addField(Zend_Search_Lucene_Field::Text(
  400. 'annotation',
  401. 'Document annotation text')
  402. );
  403. $index->addDocument($doc);
  404. ]]></programlisting>
  405. </para>
  406. </sect2>
  407. <sect2 id="zend.search.lucene.index-creation.pptx-documents">
  408. <title>Powerpoint 2007 documents</title>
  409. <para>
  410. <classname>Zend_Search_Lucene</classname> offers a Powerpoint 2007 parsing feature.
  411. Documents can be created directly from a Powerpoint 2007 file:
  412. <programlisting language="php"><![CDATA[
  413. $doc = Zend_Search_Lucene_Document_Pptx::loadPptxFile($filename);
  414. $index->addDocument($doc);
  415. ]]></programlisting>
  416. </para>
  417. <para>
  418. <classname>Zend_Search_Lucene_Document_Pptx</classname> class uses the
  419. <code>ZipArchive</code> class and <code>simplexml</code> methods to parse the source
  420. document. If the <code>ZipArchive</code> class (from module php_zip) is not available,
  421. the <classname>Zend_Search_Lucene_Document_Pptx</classname> will also not be available
  422. for use with Zend Framework.
  423. </para>
  424. <para>
  425. <classname>Zend_Search_Lucene_Document_Pptx</classname> class recognizes document meta
  426. data and document text. Meta data consists, depending on document contents, of filename,
  427. title, subject, creator, keywords, description, lastModifiedBy, revision, modified,
  428. created.
  429. </para>
  430. <para>
  431. The 'filename' field is the actual Powerpoint 2007 file name.
  432. </para>
  433. <para>
  434. The 'title' field is the actual document title.
  435. </para>
  436. <para>
  437. The 'subject' field is the actual document subject.
  438. </para>
  439. <para>
  440. The 'creator' field is the actual document creator.
  441. </para>
  442. <para>
  443. The 'keywords' field contains the actual document keywords.
  444. </para>
  445. <para>
  446. The 'description' field is the actual document description.
  447. </para>
  448. <para>
  449. The 'lastModifiedBy' field is the username who has last modified the actual document.
  450. </para>
  451. <para>
  452. The 'revision' field is the actual document revision number.
  453. </para>
  454. <para>
  455. The 'modified' field is the actual document last modified date / time.
  456. </para>
  457. <para>
  458. The 'created' field is the actual document creation date / time.
  459. </para>
  460. <para>
  461. The 'body' field is the actual content of all slides and slide notes in the Powerpoint
  462. 2007 document.
  463. </para>
  464. <para>
  465. The <methodname>loadPptxFile()</methodname> methods of
  466. <classname>Zend_Search_Lucene_Document_Pptx</classname> class also have second optional
  467. argument. If it's set to <constant>TRUE</constant>, then body content is also stored
  468. within index and can be retrieved from the index. By default, the body is tokenized and
  469. indexed, but not stored.
  470. </para>
  471. <para>
  472. Parsed documents may be augmented by the programmer with any other field:
  473. <programlisting language="php"><![CDATA[
  474. $doc = Zend_Search_Lucene_Document_Pptx::loadPptxFile($filename);
  475. $doc->addField(Zend_Search_Lucene_Field::UnIndexed(
  476. 'indexTime',
  477. time()));
  478. $doc->addField(Zend_Search_Lucene_Field::Text(
  479. 'annotation',
  480. 'Document annotation text'));
  481. $index->addDocument($doc);
  482. ]]></programlisting>
  483. </para>
  484. </sect2>
  485. <sect2 id="zend.search.lucene.index-creation.xlsx-documents">
  486. <title>Excel 2007 documents</title>
  487. <para>
  488. <classname>Zend_Search_Lucene</classname> offers a Excel 2007 parsing feature. Documents
  489. can be created directly from a Excel 2007 file:
  490. <programlisting language="php"><![CDATA[
  491. $doc = Zend_Search_Lucene_Document_Xlsx::loadXlsxFile($filename);
  492. $index->addDocument($doc);
  493. ]]></programlisting>
  494. </para>
  495. <para>
  496. <classname>Zend_Search_Lucene_Document_Xlsx</classname> class uses the
  497. <code>ZipArchive</code> class and <code>simplexml</code> methods to parse the source
  498. document. If the <code>ZipArchive</code> class (from module php_zip) is not available,
  499. the <classname>Zend_Search_Lucene_Document_Xlsx</classname> will also not be available
  500. for use with Zend Framework.
  501. </para>
  502. <para>
  503. <classname>Zend_Search_Lucene_Document_Xlsx</classname> class recognizes document meta
  504. data and document text. Meta data consists, depending on document contents, of filename,
  505. title, subject, creator, keywords, description, lastModifiedBy, revision, modified,
  506. created.
  507. </para>
  508. <para>
  509. The 'filename' field is the actual Excel 2007 file name.
  510. </para>
  511. <para>
  512. The 'title' field is the actual document title.
  513. </para>
  514. <para>
  515. The 'subject' field is the actual document subject.
  516. </para>
  517. <para>
  518. The 'creator' field is the actual document creator.
  519. </para>
  520. <para>
  521. The 'keywords' field contains the actual document keywords.
  522. </para>
  523. <para>
  524. The 'description' field is the actual document description.
  525. </para>
  526. <para>
  527. The 'lastModifiedBy' field is the username who has last modified the actual document.
  528. </para>
  529. <para>
  530. The 'revision' field is the actual document revision number.
  531. </para>
  532. <para>
  533. The 'modified' field is the actual document last modified date / time.
  534. </para>
  535. <para>
  536. The 'created' field is the actual document creation date / time.
  537. </para>
  538. <para>
  539. The 'body' field is the actual content of all cells in all worksheets of the Excel 2007
  540. document.
  541. </para>
  542. <para>
  543. The <methodname>loadXlsxFile()</methodname> methods of
  544. <classname>Zend_Search_Lucene_Document_Xlsx</classname> class also have second optional
  545. argument. If it's set to <constant>TRUE</constant>, then body content is also stored
  546. within index and can be retrieved from the index. By default, the body is tokenized and
  547. indexed, but not stored.
  548. </para>
  549. <para>
  550. Parsed documents may be augmented by the programmer with any other field:
  551. <programlisting language="php"><![CDATA[
  552. $doc = Zend_Search_Lucene_Document_Xlsx::loadXlsxFile($filename);
  553. $doc->addField(Zend_Search_Lucene_Field::UnIndexed(
  554. 'indexTime',
  555. time()));
  556. $doc->addField(Zend_Search_Lucene_Field::Text(
  557. 'annotation',
  558. 'Document annotation text'));
  559. $index->addDocument($doc);
  560. ]]></programlisting>
  561. </para>
  562. </sect2>
  563. </sect1>