Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extract-document-data in search options erroring

I attempted to follow the example in the search developers guide for configuring record elements to be extracted in the search results.

<options xmlns="http://marklogic.com/appservices/search">
    <extract-document-data>
        <extract-path xmlns:pdbe="http://schemas.abbvienet.com/people-db/envelope" xmlns:pdbm="http://schemas.abbvienet.com/people-db/model">/pdbe:person-envelope/pdbm:person/pdbm:account</extract-path>
    </extract-document-data>
</options>

With those options, I get the error.

[1.0-ml] XDMP-UNBPRFX: (err:XPST0081) Prefix pdbe has no namespace binding

Even when I try the example from the example from the guide, verbatim, I get the error as well (that is as long as I am getting hits back and it is trying to extract, if there are no hits, then it does not error).

Am I doing something wrong?

UPDATE

If I add the namespaces with the /config/namespaces REST endpoint first, and then search using the REST API, then I get the extracted values. But, I am unable to test using search:search in the query console. If I remove the config/namespaces, then I see the same error in the query console as directly from the REST endpoint.

like image 386
TJ Tang Avatar asked Jun 09 '26 21:06

TJ Tang


1 Answers

The documented example in the Syntax Summary section has a typo (I've alerted the docs team): the xmlns attribute is misspelled "xmnls". That would account for the error when using that verbatim example.

Pasting in your example as-is, it looks like it works fine (MarkLogic 8.0-5.2). Perhaps you corrected the "xmnls" error while posting the question?

import module namespace search = "http://marklogic.com/appservices/search"
  at "/MarkLogic/appservices/search/search.xqy";

search:search("hello sample-property-constraint:boo",
  <options xmlns="http://marklogic.com/appservices/search">
    <extract-document-data>
      <extract-path 
          xmlns:pdbe="http://schemas.abbvienet.com/people-db/envelope" 
          xmlns:pdbm="http://schemas.abbvienet.com/people-db/model">
        /pdbe:person-envelope/pdbm:person/pdbm:account
      </extract-path>
    </extract-document-data>
  </options>)
like image 75
Dave Cassel Avatar answered Jun 11 '26 23:06

Dave Cassel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!