Search in sources :

Example 21 with PropertyTree

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' )");
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) Test(org.junit.jupiter.api.Test)

Example 22 with PropertyTree

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);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) Node(com.enonic.xp.node.Node) Test(org.junit.jupiter.api.Test)

Example 23 with PropertyTree

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());
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree)

Example 24 with PropertyTree

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);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) Node(com.enonic.xp.node.Node) Test(org.junit.jupiter.api.Test)

Example 25 with PropertyTree

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;
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) Node(com.enonic.xp.node.Node)

Aggregations

PropertyTree (com.enonic.xp.data.PropertyTree)660 Test (org.junit.jupiter.api.Test)405 PropertySet (com.enonic.xp.data.PropertySet)150 Content (com.enonic.xp.content.Content)126 Node (com.enonic.xp.node.Node)112 CreateContentParams (com.enonic.xp.content.CreateContentParams)64 Form (com.enonic.xp.form.Form)37 Page (com.enonic.xp.page.Page)32 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)31 DescriptorKey (com.enonic.xp.page.DescriptorKey)30 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)30 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)28 PrincipalKey (com.enonic.xp.security.PrincipalKey)28 BinaryReference (com.enonic.xp.util.BinaryReference)28 Property (com.enonic.xp.data.Property)26 UpdateContentParams (com.enonic.xp.content.UpdateContentParams)24 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)23 ByteSource (com.google.common.io.ByteSource)22 ExtraData (com.enonic.xp.content.ExtraData)21 Instant (java.time.Instant)21