Creating the Index File
What we're trying to accomplish is for a user to type in a keyword and get back a list of all products that have that keyword as part of the name or the description. Now, we could search the products themselves, but that would mean parsing the entire products.xml file and searching through a lot of information that isn't relevant every time someone does a search.
A more efficient way to do it would be to create a file that is ready to search. For instance, we are actually looking for individual words, so this file would have the names and descriptions already broken up that way. This way, we can just search the individual words, and when we find one, we'll have the product_id handy—and from there, we can get right to the ...
Get XML and Java™ from scratch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.