Package org.lilyproject.indexer.model.indexerconf

Examples of org.lilyproject.indexer.model.indexerconf.IndexField


        final IndexFields indexFields = INDEXER_CONF.getIndexFields();
        indexFields.visitAll(new Predicate<MappingNode>() {
            @Override
            public boolean apply(MappingNode input) {
                if (input instanceof IndexField) {
                    final IndexField indexField = (IndexField) input;

                    if ("cc_less_variant_spaces".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Set<String> dimensions = ((VariantFollow) follows.get(0)).getDimensions();
                        assertEquals(1, dimensions.size());
                        assertTrue(dimensions.contains("my branch"));
                    } else if ("cc_less_variant_spaces_twice".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Set<String> dimensions = ((VariantFollow) follows.get(0)).getDimensions();
                        assertEquals(2, dimensions.size());
                        assertTrue(dimensions.contains("my branch"));
                        assertTrue(dimensions.contains("some lang"));
                    } else if ("cc_more_variant_spaces".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Map<String, String> dimensions =
                                ((ForwardVariantFollow) follows.get(0)).getDimensions();
                        assertEquals(1, dimensions.size());
                        assertTrue(dimensions.containsKey("my branch"));
                        assertNull(dimensions.get("my branch"));
                    } else if ("cc_more_variant_spaces_twice".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Map<String, String> dimensions =
                                ((ForwardVariantFollow) follows.get(0)).getDimensions();
                        assertEquals(2, dimensions.size());
                        assertTrue(dimensions.containsKey("my branch"));
                        assertNull(dimensions.get("my branch"));
                        assertTrue(dimensions.containsKey("some lang"));
                        assertNull(dimensions.get("some lang"));
                    } else if ("cc_more_variant_spaces_value".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Map<String, String> dimensions =
                                ((ForwardVariantFollow) follows.get(0)).getDimensions();
                        assertEquals(1, dimensions.size());
                        assertTrue(dimensions.containsKey("branch"));
                        assertEquals("some value", dimensions.get("branch"));
                    } else if ("cc_more_variant_spaces_twice_value".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Map<String, String> dimensions =
                                ((ForwardVariantFollow) follows.get(0)).getDimensions();
                        assertEquals(2, dimensions.size());
                        assertTrue(dimensions.containsKey("branch"));
                        assertEquals("some value", dimensions.get("branch"));
                        assertTrue(dimensions.containsKey("lang"));
                        assertEquals("some lang", dimensions.get("lang"));
                    } else if ("cc_more_variant_spaces_key_and_value".equals(indexField.getName().getTemplate())) {
                        final List<Follow> follows = ((DerefValue) indexField.getValue()).getFollows();
                        assertEquals(1, follows.size());
                        final Map<String, String> dimensions =
                                ((ForwardVariantFollow) follows.get(0)).getDimensions();
                        assertEquals(2, dimensions.size());
                        assertTrue(dimensions.containsKey("my branch"));
                        assertEquals("some value", dimensions.get("my branch"));
                        assertTrue(dimensions.containsKey("my lang"));
                        assertEquals("some lang", dimensions.get("my lang"));
                    } else {
                        throw new IllegalStateException("unexpected index field " + indexField.getName().getTemplate());
                    }
                }

                return true; // to make visit continue
            }
View Full Code Here


        }

        @Override
        public boolean apply(MappingNode mappingNode) {
            if (mappingNode instanceof IndexField) {
                IndexField indexField = (IndexField)mappingNode;
                if (fieldType.equals(indexField.getValue().getTargetFieldType())) {
                    foundRelevant = true;
                }
            }
            return !foundRelevant;
        }
View Full Code Here

TOP

Related Classes of org.lilyproject.indexer.model.indexerconf.IndexField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.