Search in sources :

Example 1 with MCRQueryParser

use of org.mycore.services.fieldquery.MCRQueryParser in project mycore by MyCoRe-Org.

the class MCRQLSearchUtilsTest method getMCRQuery.

private MCRQuery getMCRQuery(String mcrql) {
    LogManager.getLogger(getClass()).info("Building query from condition: {}", mcrql);
    Element query = new Element("query").setAttribute("numPerPage", "20");
    Element conditions = new Element("conditions").setAttribute("format", "xml");
    MCRCondition<Void> condition = new MCRQueryParser().parse(mcrql);
    query.addContent(conditions);
    conditions.addContent(condition.toXML());
    Document queryDoc = new Document(query);
    return MCRQLSearchUtils.buildFormQuery(queryDoc.getRootElement());
}
Also used : Element(org.jdom2.Element) MCRQueryParser(org.mycore.services.fieldquery.MCRQueryParser) Document(org.jdom2.Document)

Aggregations

Document (org.jdom2.Document)1 Element (org.jdom2.Element)1 MCRQueryParser (org.mycore.services.fieldquery.MCRQueryParser)1