O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required