For Places, we want both. Adding to the index as new data is added to the site is vital for a
useful web site. We also want the ability to re-index all the data in one hit so that we can optimize the search
index files as the amount of data on the site gets larger. We??™ll start by looking at adding to the index as we go
along as we can leverage that work for the full re-index later.
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
Designing the index
When creating out index, we need to consider the fields that we are going to create in our index. The
search index is going to contain records of different types, such as paces, reviews or user profile data but
presents to the user a list of web pages to view. Therefore we unify the set of fields in the index so that the
results will make sense to the user. Table 8.5 shows the set of fields we will use.
Table 8.5 Lucene field types for adding fields to an index
Field name Type Notes
class UnIndexed The class name of the stored data. We need this on retrieval in order to be able to create a URL to the
correct page in the results list.
key UnIndexed The key of the stored data. Usually this is the id of the data record.
Pages:
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226