问题
As seen on http://developer.marklogic.com/learn/java/analytics, you are able to do faceted searches with the JavaAPI. However, the examples on that page use QueryOptionsBuilder
, which has been deprecated.
Is there an alternative to using QueryOptionsBuilder
in the JavaAPI to do faceted searches at this time? Or are we stuck using a deprecated class until some future release?
Thanks!
回答1:
Yes, there is an alternative. You can send or receive query options as JSON or XML instead of using the deprecated builder.
To expand a bit, the QueryOptionsManager.writeOptions() method accepts any class that implements the QueryOptionsWriteHandle marker interface. Besides the QueryOptionsHandle class, implementing classes include the write handles for JSON or XML.
Similarly, the readOptions() method accepts the classes that implement the QueryOptionsReadHandle marker interface, which include the read handles for JSON or XML.
- http://docs.marklogic.com/javadoc/client/com/marklogic/client/admin/QueryOptionsManager.html
- http://docs.marklogic.com/javadoc/client/com/marklogic/client/io/marker/QueryOptionsWriteHandle.html
- http://docs.marklogic.com/javadoc/client/com/marklogic/client/io/marker/QueryOptionsReadHandle.html
回答2:
At http://docs.marklogic.com/javadoc/client/com/marklogic/client/admin/config/QueryOptions.html I see: "use a JSON or XML handle instead to write or read query options." I think that refers to http://docs.marklogic.com/javadoc/client/com/marklogic/client/query/QueryManager.html - and http://docs.marklogic.com/javadoc/client/overview-summary.html may help too.
来源:https://stackoverflow.com/questions/18448945/queryoptionsbuilder-deprecation