Hi Gregory,

I think it's a simple namespace issue (and you're not the first person to 
encounter it...)

Try modifying your input to put the constraint elements into the correct 
namespace, like this:

declare variable $ADDITIONAL-OPTIONS := (
  <constraint name="title" xmlns="http://marklogic.com/appservices/search";>
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="title"/>
    </word>
  </constraint>,
  <constraint name="creator" xmlns="http://marklogic.com/appservices/search";>
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="namePart"/>
    </word>
  </constraint>
);  

--Colleen

________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Murray, Gregory 
[[email protected]]
Sent: Friday, June 10, 2011 8:28 AM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Application Builder $ADDITIONAL-OPTIONS

When customizing an app generated by Application Builder, the technique 
described in the "Application Builder Developer's Guide" in section 4.3.7.1 
"Adding a searchable-expression Option" sounds great, but I can't get it to 
work for me.

The technique involves using the $ADDITIONAL-OPTIONS variable in 
custom/appfunctions.xqy to add elements (in my case <constraint> elements) to 
the <options> used with the Search API. The custom elements are supposed to get 
added because of this:

declare variable $OPTIONS-STANDARD :=
  <options xmlns="http://marklogic.com/appservices/search";>

    ... lots of other elements ...

    { $app:ADDITIONAL-OPTIONS }
  </options>;

in lib/config.xqy

But what I've found is that if I add elements to $ADDITIONAL-OPTIONS they have 
no effect. If I instead customize the $OPTIONS variable in appfunctions.xqy by 
copying <options> verbatim from lib/config.xqy and then adding my custom 
elements directly into <options>, my constraints work just fine.

In other words, I'm supposed to be able to do this:

declare variable $ADDITIONAL-OPTIONS := (
  <constraint name="title">
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="title"/>
    </word>
  </constraint>,
  <constraint name="creator">
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="namePart"/>
    </word>
  </constraint>
);

but instead I have to do this:

declare variable $OPTIONS :=
<options xmlns="http://marklogic.com/appservices/search";>

  ... a verbatim copy of everything in <options> from $OPTIONS-STANDARD in 
lib/config.xqy ...

  <constraint name="title">
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="title"/>
    </word>
  </constraint>
  <constraint name="creator">
    <word>
      <element ns="http://www.loc.gov/mods/v3"; name="namePart"/>
    </word>
  </constraint>
</options>;

Any ideas?

Thanks,
Greg

Gregory Murray
Digital Library Application Developer
Princeton Theological Seminary

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

Reply via email to