The response for extract-document-data doesn't come through as metadata.  It 
comes through as a <search:extracted><search:extracted> element.  We'll be 
enhancing MatchDocumentSummary (via SearchHandle) to have accessor method for 
that, but it's not there yet.

Here's some sample code you can use immediately:

        Document results = queryMgr.search(query, new DOMHandle()).get();
        NodeList extracts = results.getElementsByTagNameNS("*", "extracted");
        for (int i=0; i < extracts.getLength(); i++ ) {
            Node extract = extracts.item(i);
        }



Sam Mefford
Senior Engineer
MarkLogic Corporation
[email protected]<mailto:[email protected]>
Cell: +1 801 706 9731
www.marklogic.com<http://www.marklogic.com>

This e-mail and any accompanying attachments are confidential. The information 
is intended
solely for the use of the individual to whom it is addressed. Any review, 
disclosure, copying,
distribution, or use of this e-mail communication by others is strictly 
prohibited. If you
are not the intended recipient, please notify us immediately by returning this 
message to
the sender and delete all copies. Thank you for your cooperation.


On 4/17/2015 10:38 AM, Köhler, Klaus wrote:
Hi Geert, thanks a lot. This is working now!

Is there a way to get the extracted data via the Java Api?

When using the QBE mode I could fetch the extracted data via

MatchDocumentSummary[] results = resultsHandle.getMatchResults();
for (MatchDocumentSummary result : results) {
       Document doc = result.getMetadata();
}

When using combined search getMetadata() returns null.

Klaus

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Geert Josten
Sent: Friday, April 17, 2015 12:58 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Rest API && <extract-document-data>

Hi Klaus,

There was a fix in 8.0-2 that addressed this. The REST-api is kind of assuming 
you want multipart/mixed response, while you didn’t actually ask for that. In 
8.0-2 this is handled differently.

Cheers,
Geert

From: Köhler, Klaus <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Friday, April 17, 2015 at 12:24 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Rest API && <extract-document-data>

Hi,

when using the Rest API and the search option <extract-document-data> I got the 
error

XDMP-AS: (err:XPTY0004) searchmodq:resolve($structured-query, $options, 
$params) -- Invalid coercion: (<search:response snippet-format="snippet" 
total="153" start="1" page-length="10" 
xmlns:search="http://marklogic.com/appservices/search";><search:result<http://marklogic.com/appservices/search%22%3E%3Csearch:result>
 index="1" uri="/programs/bef81c54-03ab-4bd8-b73c-...</search:response>, 
fn:doc("/programs/bef81c54-03ab-4bd8-b73c-16a2b6980455.xml"), 
fn:doc("/programs/763865fe-050c-4512-9ce6-b44ab8a8cd12.xml"), ...) as 
element(search:response) . See the MarkLogic server error log for further 
detail."

The search options are as following:
<search  
xmlns="http://marklogic.com/appservices/search";<http://marklogic.com/appservices/search%22>>
<options>
  <constraint name="test">
    <value>
      <element ns="" name="componentUuid" />
    </value>
  </constraint>
<extract-document-data selected="all"/>
</options>
</search>

Using the XQuery console everything works fine.

Any idea?

Klaus Köhler

Software Architect
Klopotek & Partner GmbH
Schlüterstraße 39
10629 Berlin
Tel. + 49 30.884 53-204
Fax + 49 30.884 53-100
mailto:[email protected]
http://www.klopotek.de

Geschäftsführung:
Ulrich Klopotek von Glowczewski (Vorsitzender)
Stefan Jacob, Wolf-Michael Mehl
AG Charlottenburg HRB 45287

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind, informieren Sie bitte sofort den 
Absender und vernichten diese E-Mail. Das Kopieren oder die Weitergabe der 
E-Mail ist in diesem Fall nicht gestattet. Aufgrund der technischen 
Gegebenheiten im Internet ist nicht auszuschließen, dass diese Nachricht auf 
dem Weg zu Ihnen gelesen oder verfälscht worden ist. Fachliche Ausführungen in 
E-Mails und/oder Anlagen dazu haben grundsätzlich Entwurfscharakter und 
bedürfen unserer schriftlichen Bestätigung.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient please notify the sender immediately and destroy 
this e-mail. In this case any copy, disclosure or distribution of the material 
in this e-mail is strictly forbidden. Due to the technical structures of the 
Internet, this message may have been scanned or faked on its way to you. 
Professional statements within an e-mail and/or attachments to an e-mail are to 
be regarded as drafts and require our written confirmation.




_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to