-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Milestone
Description
I've copied the following bug report that came in from another source.
I am using the StructuredQueryBuilder to build a structured query. See below Java snippet.
StructuredQueryBuilder qb = new StructuredQueryBuilder("default");
StructuredQueryDefinition querydef = qb.containerConstraint("jobInstance", qb.valueConstraint("jobName", jobInstance.getJobName()));
SearchHandle results = queryMgr.search(querydef, new SearchHandle());
I already have a default options loaded in the database.
default.xml
< options xmlns="http://marklogic.com/appservices/search" >
< constraint name="jobInstance" >
< element-query name="jobInstance" ns="http://projects.spring.io/spring-batch" / >
< /constraint >
< constraint name="jobName" >
< value >
< element name="jobName" ns="http://projects.spring.io/spring-batch" / >
< /value >
< /constraint >
< /options >
The query that is generated is invalid because it is missing a namespace. The problem is related to the lack of a default namespace.
< query **xmlns:search="http://marklogic.com/appservices/search"** xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
< container-constraint-query >
< constraint-name>jobInstance</constraint-name>
< value-constraint-query>
< constraint-name>jobName</constraint-name>
< text>sampleJob</text>
< /value-constraint-query>
< /container-constraint-query>
< /query>