Last active
December 18, 2015 02:28
-
-
Save peterskim12/5710840 to your computer and use it in GitHub Desktop.
Example of MarkLogic REST API and Play Framework XPath support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map<String, String> namespaces = new HashMap<String, String>(); | |
namespaces.put("search", "http://marklogic.com/appservices/search"); | |
namespaces.put("wiki", "http://marklogic.com/wikipedia"); | |
StructuredQueryBuilder queryBuilder = new StructuredQueryBuilder("all"); | |
StructuredQueryDefinition queryDef = queryBuilder.term(query); | |
SearchHandle results = markLogicService.search(queryDef); | |
for (MatchDocumentSummary result : results.getMatchResults()) { | |
String year = XPath.selectText("/search:metadata/search:attribute-meta[@name='year' and @parent-name='nominee']", result.getMetadata(), namespaces); | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment