@Test public void testBug22037() throws KeyManagementException, NoSuchAlgorithmException, IOException, ParserConfigurationException, SAXException, XpathException, TransformerException { System.out.println("Running testBug22037"); String[] filenames = { "constraint1.xml", "constraint2.xml", "constraint3.xml", "constraint4.xml", "constraint5.xml" }; String queryOptionName = "rangeConstraintIntOpt.xml"; DatabaseClient client = getDatabaseClient("rest-admin", "x", getConnType()); // write docs for (String filename : filenames) { writeDocumentUsingInputStreamHandle(client, filename, "/range-constraint/", "XML"); } setQueryOption(client, queryOptionName); QueryManager queryMgr = client.newQueryManager(); StructuredQueryBuilder qb = queryMgr.newStructuredQueryBuilder(queryOptionName); StructuredQueryDefinition rangeQuery = qb.range(qb.element("popularity"), "xs:int", Operator.GE, 4); // create handle DOMHandle resultsHandle = new DOMHandle(); queryMgr.search(rangeQuery, resultsHandle); // get the result Document resultDoc = resultsHandle.get(); // System.out.println(convertXMLDocumentToString(resultDoc)); assertXpathEvaluatesTo("4", "string(//*[local-name()='result'][last()]//@*[local-name()='index'])", resultDoc); // release client client.release(); }
m = qb.range(qb.element("name"), "xs:string", Operator.GE, "value1", "value2"); for (String q: new String[]{qb.build(m).toString()}) { xml = new StringInputStream(q); m = qb.range(qb.element("name"), "xs:string", "http://marklogic.com/collation", FragmentScope.DOCUMENTS, new String[] {"score-function=linear", "scale-factor=4.2"}, Operator.GE, "value1", "value2"); for (String q: new String[]{qb.build(m).toString()}) { xml = new StringInputStream(q);
StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", Operator.GE, 4);
StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", options, Operator.LE, 4);
StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", collation, FragmentScope.DOCUMENTS, Operator.GT, 4);
String[] options = { "uncached", "min-occurs=2" }; String collation = "http://marklogic.com/collation/en"; StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", collation, options, Operator.LT, 4);
String[] options = { "uncached", "min-occurs=2" }; StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", collation, FragmentScope.DOCUMENTS, options, Operator.NE, 4);
StructuredQueryDefinition t = qb.range(qb.element("popularity"), "xs:integer", collation, Operator.GE, 4);
sqb.value(sqb.jsonProperty("state"), "resolved", "closed", "finalized"), sqb.not( sqb.value(sqb.jsonProperty("hold"), "true") ), sqb.range( sqb.jsonProperty("lastModified"), "xs:dateTime", new String[0],
StructuredQueryDefinition t2 = qb.range(qb.jsonProperty("price"), "xs:integer", Operator.GE, "0.1");