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

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


                    List<String> indexFields = new ArrayList<String>();
                    for(String field : fields){
                        //we need to get the actual fields in the index for the
                        //logical fields parsed with the constraint
                        IndexDataTypeEnum mapedIndexTypeEnum = IndexDataTypeEnum.forDataTyoe(simConstraint.getContextType());
                        IndexField indexField = new IndexField(Collections.singletonList(field),
                            mapedIndexTypeEnum == null ? null : mapedIndexTypeEnum.getIndexType(),
                            simConstraint.getLanguages());
                        indexFields.addAll(fieldMapper.getQueryFieldNames(indexField));
                    }
                    query.set(SIMILARITY_FIELDS, indexFields.toArray(new String[fields.size()]));
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, upperBound);
            indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.GE, lowerBound);
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

                "The parsed Solr Document does not contain a value for the %s Field!",
                fieldMapper.getDocumentIdField()));
        }
        Representation rep = getValueFactory().createRepresentation(id.toString());
        for (String fieldName : doc.getFieldNames()) {
            IndexField indexField = fieldMapper.getField(fieldName);
            if (indexField != null && indexField.getPath().size() == 1) {
                String lang = indexField.getLanguages().isEmpty() ? null : indexField.getLanguages()
                        .iterator().next();
                if (fields == null || fields.contains(indexField.getPath().get(0))) {
                    for (Object value : doc.getFieldValues(fieldName)) {
                        if (value != null) {
                            IndexDataTypeEnum dataTypeEnumEntry = IndexDataTypeEnum.forIndexType(indexField
                                    .getDataType());
                            if (dataTypeEnumEntry != null) {
                                Object javaValue = indexValueFactory.createValue(
                                    dataTypeEnumEntry.getJavaType(), indexField.getDataType(), value, lang);
                                if (javaValue != null) {
                                    rep.add(indexField.getPath().iterator().next(), javaValue);
                                } else {
                                    log.warn(String.format("java value=null for index value %s", value));
                                }
                            } else {
                                log.warn(String.format(
                                    "No DataType Configuration found for Index Data Type %s!",
                                    indexField.getDataType()));
                            }
                        } // else index value == null -> ignore
                    } // end for all values
                }
            } else {
View Full Code Here

                "The parsed Solr Document does not contain a value for the %s Field!",
                fieldMapper.getDocumentIdField()));
        }
        Representation rep = getValueFactory().createRepresentation(id.toString());
        for (String fieldName : doc.getFieldNames()) {
            IndexField indexField = fieldMapper.getField(fieldName);
            if (indexField != null && indexField.getPath().size() == 1) {
                String lang = indexField.getLanguages().isEmpty() ? null : indexField.getLanguages()
                        .iterator().next();
                if (fields == null || fields.contains(indexField.getPath().get(0))) {
                    for (Object value : doc.getFieldValues(fieldName)) {
                        if (value != null) {
                            IndexDataTypeEnum dataTypeEnumEntry = IndexDataTypeEnum.forIndexType(indexField
                                    .getDataType());
                            if (dataTypeEnumEntry != null) {
                                Object javaValue = indexValueFactory.createValue(
                                    dataTypeEnumEntry.getJavaType(), indexField.getDataType(), value, lang);
                                if (javaValue != null) {
                                    rep.add(indexField.getPath().iterator().next(), javaValue);
                                } else {
                                    log.warn(String.format("java value=null for index value %s", value));
                                }
                            } else {
                                log.warn(String.format(
                                    "No DataType Configuration found for Index Data Type %s!",
                                    indexField.getDataType()));
                            }
                        } // else index value == null -> ignore
                    } // end for all values
                }
            } else {
View Full Code Here

                "The parsed Solr Document does not contain a value for the %s Field!",
                fieldMapper.getDocumentIdField()));
        }
        Representation rep = getValueFactory().createRepresentation(id.toString());
        for (String fieldName : doc.getFieldNames()) {
            IndexField indexField = fieldMapper.getField(fieldName);
            if (indexField != null && indexField.getPath().size() == 1) {
                String lang = indexField.getLanguages().isEmpty() ? null : indexField.getLanguages()
                        .iterator().next();
                if (fields == null || fields.contains(indexField.getPath().get(0))) {
                    for (Object value : doc.getFieldValues(fieldName)) {
                        if (value != null) {
                            IndexDataTypeEnum dataTypeEnumEntry = IndexDataTypeEnum.forIndexType(indexField
                                    .getDataType());
                            if (dataTypeEnumEntry != null) {
                                Object javaValue = indexValueFactory.createValue(
                                    dataTypeEnumEntry.getJavaType(), indexField.getDataType(), value, lang);
                                if (javaValue != null) {
                                    rep.add(indexField.getPath().iterator().next(), javaValue);
                                } else {
                                    log.warn(String.format("java value=null for index value %s", value));
                                }
                            } else {
                                log.warn(String.format(
                                    "No DataType Configuration found for Index Data Type %s!",
                                    indexField.getDataType()));
                            }
                        } // else index value == null -> ignore
                    } // end for all values
                }
            } else {
View Full Code Here

                    query.set(MIN_DOC_FREQ, 1);
                    query.set(MIN_TERM_FREQ, 1);
                    query.set(INTERESTING_TERMS, "details");
                    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

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.