Search Engine Components - Zend

A search engine is a complex application that requires many different parts to function properly. One layer is built on top of the other, and each layer adds additional functionality to the next. There are four components to the search engine, as shown in Figure.

Search Engine Components

The search engine is composed of an index, segments, documents, and fields. The index is the main file that contains a collection of documents. It contains the data the user can search through and is represented as a physical file stored in the local file system. Indexes contain segments that are created each time a document is added into the index.

Segments are sub-indexes that can be searched independently. The more segments in an index, the slower the performance of the index and ultimately your searches.

Documents contain the actual data the user can search through. Documents contain content such as HTML content from a page, the title of a book, or any other value that is deemed important for the user.

Each document is further broken down into fields. Each field in the document contains itemized content. For example, the document containing book information could contain three fields: title field, date field, and description field. Each field is open for the user to search through.

In the world of Zend Framework, each layer shown in Figure is represented as objects, except for the segment, which is handled behind the scenes. The index is represented as a Zend_ Search_ Lucene object and is stored in a directory of your choosing. Documents that are stored in the index are represented as Zend_ Search_ Lucene_ Document objects and contain Zend_ Search_ Lucene_ Field objects.

Letfs start creating each of the pieces that the search engine needs .


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Zend Topics