We have a search options (named "all") on our project (using ML 7.0.4) where all constraints are defined. However in certain searches we only want to retrieve facet values for certain constraints.
One way to do this is to define the constraint at runtime using the QueryOptionsHandle – however this has been deprecated.
Using the Java Client API (2.04) to solve this, we were using QueryOptionsManager to read options "all" first. Then we wanted to retrieve facet definition (QueryOptionsHandle#getConstraint()).
http://docs.marklogic.com/javadoc/client/com/marklogic/client/io/QueryOptionsHandle.html
Unfortunately it turns out that the returned handle (QueryOptions.QueryConstraint) is deprecated, although getConstraint is not (should it be deprecated also?).