Examples of IndexField


Examples of org.apache.stanbol.entityhub.yard.solr.model.IndexField

        }
    }

    @Override
    public Collection<String> getFieldNames(List<String> path, IndexValue indexValue) throws IllegalArgumentException {
        IndexField field;
        if (indexValue.hasLanguage()) {
            field = new IndexField(path, indexValue.getType(), indexValue.getLanguage());
        } else {
            field = new IndexField(path, indexValue.getType());
        }
        return getFieldNames(field);
    }
View Full Code Here

Examples of org.elasticsearch.search.lookup.IndexField

    }

    @Override
    public Object run() {
        float score = 0;
        IndexField indexField = indexLookup().get(field);
        for (int i = 0; i < terms.length; i++) {
            IndexFieldTerm indexFieldTerm = indexField.get(terms[i]);
            try {
                if (indexFieldTerm.tf() != 0) {
                    score += indexFieldTerm.tf() * indexField.docCount() / indexFieldTerm.df();
                }
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
View Full Code Here

Examples of org.elasticsearch.search.lookup.IndexField

    }

    @Override
    public Object run() {
        float score = 0;
        IndexField indexField = indexLookup().get(field);
        for (int i = 0; i < terms.length; i++) {
            IndexFieldTerm indexFieldTerm = indexField.get(terms[i], IndexLookup.FLAG_PAYLOADS | IndexLookup.FLAG_CACHE);
            for (TermPosition pos : indexFieldTerm) {
                score += pos.payloadAsFloat(0);
            }
        }
        return score;
View Full Code Here

Examples of org.elasticsearch.search.lookup.IndexField

    }

    @Override
    public Object run() {
        float score = 0;
        IndexField indexField = indexLookup().get(field);
        for (int i = 0; i < terms.length; i++) {
            IndexFieldTerm indexFieldTerm = indexField.get(terms[i], IndexLookup.FLAG_PAYLOADS);
            for (TermPosition pos : indexFieldTerm) {
                score += pos.payloadAsFloat(0);
            }
        }
        return score;
View Full Code Here

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

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

        }

        @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

Examples of org.springframework.data.mongodb.core.index.IndexField

    assertThat(ii.isUnique(), is(true));
    assertThat(ii.isDropDuplicates(), is(true));
    assertThat(ii.isSparse(), is(false));

    List<IndexField> indexFields = ii.getIndexFields();
    IndexField field = indexFields.get(0);

    assertThat(field, is(IndexField.create("age", Direction.DESC)));
  }
View Full Code Here

Examples of org.springframework.data.mongodb.core.index.IndexField

    IndexInfo info = template.indexOps(Person.class).getIndexInfo().get(1);
    assertThat(info.isUnique(), is(true));
    assertThat(info.isSparse(), is(true));

    List<IndexField> indexFields = info.getIndexFields();
    IndexField field = indexFields.get(0);

    assertThat(field, is(IndexField.create("age", Direction.DESC)));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.