Description
I didn't used to think this would be possible without significantly increasing the complexity of the search. However, now it appears that an optional input could be achieved by essentially forking the query, adding the optional input as a required input, and attempting to fulfill that clause. If it can not be fulfilled, then it isn't available and the rule should use the default value. Because there is only ever one rule which can be used to fulfill any given clause, this search can be done independently from the rest of the search space. The order that optional clauses are resolved will have no effect on the result of the search.
This will still most likely require a bit of a refactor to allow this kind of potentially unsuccessful fork of the query search. It will also be difficult to run this subquery efficiently, so that it doesn't wind up fulfilling all of the other clauses yet to be completed in the query.