use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class FindNodesByQueryCommandTest_func_range method numeric_values.
@Test
public void numeric_values() throws Exception {
final PropertyTree node1 = new PropertyTree();
node1.addDouble("myValue", 2.0);
final PropertyTree node2 = new PropertyTree();
node2.addDouble("myValue", 3.0);
createNode(CreateNodeParams.create().parent(NodePath.ROOT).name("node-1").data(node1).build());
createNode(CreateNodeParams.create().parent(NodePath.ROOT).name("node-2").data(node2).build());
queryAndAssert(0, "range('myValue', 2.0, 3.0 )");
queryAndAssert(0, "range('myValue', 2.0, 3.0, 'false', 'false' )");
queryAndAssert(1, "range('myValue', 2.0, 3.0, 'true', 'false' )");
queryAndAssert(2, "range('myValue', 2.0, 3.0, 'true', 'true' )");
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class FindNodesByQueryCommandTest_func_stemmed method ascii_folding_with_wildcard.
@Test
public void ascii_folding_with_wildcard() throws Exception {
final PropertyTree data = new PropertyTree();
data.addString("title", "grønnsaker");
final Node node = createNode(CreateNodeParams.create().name("my-node-1").parent(NodePath.ROOT).data(data).indexConfigDocument(PatternIndexConfigDocument.create().analyzer(NodeConstants.DOCUMENT_INDEX_DEFAULT_ANALYZER).defaultConfig(IndexConfig.BY_TYPE).addAllTextConfigLanguage("no").build()).build());
refresh();
queryAndAssert(node, "stemmed('_allText', 'grønnsake*', 'AND', 'no')", 1);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class FindNodesByQueryCommandTest_geoPoint method createNodeWithLocation.
private Node createNodeWithLocation(final GeoPoint geoPoint, final String name, final NodePath parent) {
final PropertyTree data = new PropertyTree();
data.addGeoPoint("myLocation", geoPoint);
return createNode(CreateNodeParams.create().parent(parent).name(name).data(data).build());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class FindNodesByQueryCommandTest_func_ngram method word_delimiter_dot.
@Test
public void word_delimiter_dot() throws Exception {
final PropertyTree data = new PropertyTree();
data.addString("title", "testing.delimiter");
final Node node = createNode(CreateNodeParams.create().name("my-node-1").parent(NodePath.ROOT).data(data).indexConfigDocument(PatternIndexConfigDocument.create().analyzer(NodeConstants.DOCUMENT_INDEX_DEFAULT_ANALYZER).defaultConfig(IndexConfig.BY_TYPE).build()).build());
queryAndAssert(node, "ngram('title', 'test', 'AND')", 1);
queryAndAssert(node, "ngram('title', 'delim', 'AND')", 1);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class FindNodesByQueryCommandTest_func_ngram method createNodes.
private Node createNodes() {
final PropertyTree data = new PropertyTree();
data.addString("title", "Levenshteins-algorithm");
final Node node = createNode(CreateNodeParams.create().name("my-node-1").parent(NodePath.ROOT).data(data).indexConfigDocument(PatternIndexConfigDocument.create().analyzer(NodeConstants.DOCUMENT_INDEX_DEFAULT_ANALYZER).defaultConfig(IndexConfig.BY_TYPE).build()).build());
final PropertyTree data2 = new PropertyTree();
data2.addString("title", "Liver and almonds");
createNode(CreateNodeParams.create().name("my-node-2").parent(NodePath.ROOT).data(data2).indexConfigDocument(PatternIndexConfigDocument.create().analyzer(NodeConstants.DOCUMENT_INDEX_DEFAULT_ANALYZER).defaultConfig(IndexConfig.BY_TYPE).build()).build());
return node;
}
Aggregations