public interface ExtractedResult extends Iterable<ExtractedItem>
String combinedSearch =
"<search:search xmlns:search=\"http://marklogic.com/appservices/search\">" +
"<search:qtext>my search terms</search:qtext>" +
"<search:options>" +
"<search:extract-document-data>" +
"<search:extract-path>/some/path</search:extract-path>" +
"<search:extract-path>/another/path/*</search:extract-path>" +
"</search:extract-document-data>" +
"</search:options>" +
"</search:search>";
StringHandle queryHandle = new StringHandle(combinedSearch).withMimetype("application/xml");
QueryDefinition query = queryMgr.newRawCombinedQueryDefinition(queryHandle);
SearchHandle results = queryMgr.search(query, new SearchHandle());
MatchDocumentSummary[] summaries = results.getMatchResults();
for (MatchDocumentSummary summary : summaries) {
ExtractedResult extracted = summary.getExtracted();
if ( Format.XML == summary.getFormat() ) {
for (ExtractedItem item : extracted) {
Document extractItem = item.getAs(Document.class);
...
}
}
}
Where you can, of course, use any appropriate StructureReadHandle or corresponding
class (provided by that handle's receiveAs() method) passed to the
ExtractedItem.getAs(java.lang.Class<T>)
method.Modifier and Type | Method and Description |
---|---|
String |
getKind()
The xquery type of the extracted data.
|
boolean |
hasNext()
Returns true if internal iterator has more elements.
|
boolean |
isEmpty()
Returns true if the underlying node is an "extracted-none" XML element or
JSON property.
|
ExtractedItem |
next()
Returns the next element in the internal iterator, which is separate
from any new iterator created by calls to iterator().
|
int |
size()
The number of ExtractedItem objects in the Iterator.
|
forEach, iterator, spliterator
String getKind()
boolean isEmpty()
int size()
ExtractedItem next()
boolean hasNext()
Copyright © 2013-2016 MarkLogic Corporation.