Package org.apache.stanbol.entityhub.yard.solr.model

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


    @Override
    public IndexField getField(String fieldName) {
        if (fieldName == null || fieldName.isEmpty()) {
            throw new IllegalArgumentException("The parsed field name MUST NOT be NULL!");
        }
        IndexField field = fieldMappings.get(fieldName);
        if (field == null) {
            if (getDocumentIdField().equals(fieldName)
                || fieldName.charAt(0) == SolrConst.SPECIAL_FIELD_PREFIX) {
                // in case of special field or the document ID, return null ->
                // meaning, that this index document field does not represent
View Full Code Here


                    path.add(fullName);
                }
            }
        }
        if (isLanguage) {
            return new IndexField(path, dataTypeEnumEntry.getIndexType(), language);
        } else {
            return new IndexField(path, dataTypeEnumEntry.getIndexType());
        }
    }
View Full Code Here

        }
    }

    @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

                    query.set(MIN_TERM_FREQ, 1);
                    query.set(INTERESTING_TERMS, "details");
                    query.set("mlt.boost", true); //testing
                    List<String> indexFields = new ArrayList<String>();
                    for(String field : fields){
                        IndexField indexField = new IndexField(Collections.singletonList(field),
                            IndexDataTypeEnum.TXT.getIndexType());
                        indexFields.addAll(fieldMapper.getFieldNames(indexField));
                    }
                    query.set(SIMILARITY_FIELDS, indexFields.toArray(new String[fields.size()]));
                    query.set(STREAM_BODY, indexValue.getValue());
View Full Code Here

        if (dataType == null) {
            indexConstraint.setInvalid("A Range Constraint MUST define at least a lower or an upper bound!");
        } else {
            //set the DATATYPE and FIED using an IndexField
            indexConstraint.setIndexFieldConstraints(
                new IndexField(indexConstraint.getPath(), dataType));
        }
        //set the value range
        if (rangeConstraint.isInclusive()) {
            indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.LE, rangeConstraint.getUpperBound());
            indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.GE, rangeConstraint.getLowerBound());
View Full Code Here

            constraintValue.getValues().add(indexValueFactory.createIndexValue(
                valueFactory.createText(text)));
        }
        //use a index field for DataType, Languages and the Field
        indexConstraint.setIndexFieldConstraints(
            new IndexField(indexConstraint.getPath(),
                IndexDataTypeEnum.TXT.getIndexType(),
                textConstraint.getLanguages()));
        //add the value for the constraint
        switch (textConstraint.getPatternType()) {
            case none:
View Full Code Here

                    indexValue = new IndexValue(value.toString(), indexDataType);
                }
                constraintValue.getValues().add(indexValue); //add the constraint
            }
            //indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.DATATYPE, indexDataType);
            IndexField indexField;
            if(IndexDataTypeEnum.TXT.getIndexType().equals(indexDataType)){
                //NOTE: in case of TEXT we need also to add the language to create a valid
                //query!
                // * We take the language of the first parsed element
                indexField = new IndexField(indexConstraint.getPath(), indexDataType,
                    constraintValue.getValues().iterator().next().getLanguage());
            } else {
                indexField = new IndexField(indexConstraint.getPath(), indexDataType);
            }
            //set FIELD, DATATYPE and LANGUAGE constraint by using the indexField
            indexConstraint.setIndexFieldConstraints(indexField);
            //set the VALUE
            //TODO: We need to somehow pass the MODE so that the encoder knows how
View Full Code Here

    @Override
    public IndexField getField(String fieldName) {
        if (fieldName == null || fieldName.isEmpty()) {
            throw new IllegalArgumentException("The parsed field name MUST NOT be NULL!");
        }
        IndexField field = fieldMappings.get(fieldName);
        if (field == null) {
            if (getDocumentIdField().equals(fieldName)
                || fieldName.charAt(0) == SolrConst.SPECIAL_FIELD_PREFIX) {
                // in case of special field or the document ID, return null ->
                // meaning, that this index document field does not represent
View Full Code Here

                    path.add(fullName);
                }
            }
        }
        if (isLanguage) {
            return new IndexField(path, dataTypeEnumEntry.getIndexType(), language);
        } else {
            return new IndexField(path, dataTypeEnumEntry.getIndexType());
        }
    }
View Full Code Here

        }
    }

    @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

TOP

Related Classes of org.apache.stanbol.entityhub.yard.solr.model.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.