We commonly encounter users who believe that searching on
two fields can be facilitated by creating two separate
indexes on those fields. This example should give you some
intuition about why this just isn’t possible.Not really, as the example only allows a search on ingredient, since it explicitly says the name is not known at all, and hence could never be used for search.
Now let's say we know two things about the unknown recipe: it contains chicken and it's from the Italian kitchen.
Given these two indexes:
Chicken
1, 15, 582, 1032
Italian
3, 15, 16, 82, 1032, 6821
I could definitely use both to speed up my search by looking only at pages that occur in both indexes (in this case, 15 and 1032). This can be done in O(# of indexes * index length) time if both indexes are in sorted order.