Hmm.. My gut reaction at first was "Well, it's a relatively small amount of data. And, you'll wind up recalculating the indexes for each search anyway. Great idea, but is it worth the effort here?"
Then, I got a message from
Stamp_Guy saying that he cannot use DB_File because complex data structures aren't supported. (C'mon.. how complex is a HoH?) So, now I am thoroughly convinced that Storable is a Good Idea, as long as the number of records doesn't get out of hand. And if you use Storable, the indexes can be stored objects too -- so the overhead of generating the indexes is gone from the search program. Sweet!
So, here's the quick and dirty:
%cars - Storable HoH as illustrated above, with any additional vehicle info added too
%makes - Storable hash of
make_id => make. This should probably be a complete list of makes, which you can find on cars.com.
%models - Storable HoH of
model_id => {
model => 'modelname',
make_id => make_id (key from %makes)
}
. You can build this make_id hash as your inventory grows. Be sure to leave off the model details/series. Ex.
model => 330 should be in this hash to cover all BMW 330's. You don't necessarily need to have one entry for 330xi, 330ci, etc. Lexus is another pain in the rear when it comes to this model naming scheme.
Then, your indexes:
%years_idx, %make_idx, %model_idx. Obviously you will need to recreate your indexes each time you make a change to the dealer's inventory. A minor race condition exists here if someone searches while you are updating the inventory, but I'll leave that for you to solve. :)