We need to make sure that the semantic wiki functions1 are efficient. We don't want to over-think efficiency, though, so let's not worry about this page too much right now.
Some possible strategies, though:
Metadata queries on a page about the page itself are easy — just clear out the cache when the metadata on that page is updated.
Complex queries across many pages and using many different values gets more complex:
[MetaSearch("(page=*&label=business_type&value=restaurant)+(page=*&label=food_type&value=vegan)","no results found","unordered")] depends on page, business_type->restaurant, food_type->vegan. We could create a new table, metadata_dependencies, and list (pagename_metadata_query_is_on, label, value). Then, we we alter metadata someplace, we check the data against our dependencies, and clear out the cache on the dependent pages.
Some of the advanced metadata searches could be offloaded onto a reporting server that is running a read-only replication to prevent loading down the primary wiki site.
- 1I'm talking about those ones that get embedded inside of a page's body. Ad-hoc queries using the search interface should just use SQL all the time.