Java Code Examples for org.alfresco.service.cmr.dictionary.PropertyDefinition#isIndexed()
The following examples show how to use
org.alfresco.service.cmr.dictionary.PropertyDefinition#isIndexed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomModelProperty.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
public CustomModelProperty(PropertyDefinition propertyDefinition, MessageLookup messageLookup) { this.name = propertyDefinition.getName().getLocalName(); this.prefixedName = propertyDefinition.getName().toPrefixString(); this.title = propertyDefinition.getTitle(messageLookup); this.dataType = propertyDefinition.getDataType().getName().toPrefixString(); this.description = propertyDefinition.getDescription(messageLookup); this.isMandatory = propertyDefinition.isMandatory(); this.isMandatoryEnforced = propertyDefinition.isMandatoryEnforced(); this.isMultiValued = propertyDefinition.isMultiValued(); this.defaultValue = propertyDefinition.getDefaultValue(); this.isIndexed = propertyDefinition.isIndexed(); this.facetable = propertyDefinition.getFacetable(); this.indexTokenisationMode = propertyDefinition.getIndexTokenisationMode(); List<ConstraintDefinition> constraintDefs = propertyDefinition.getConstraints(); if (constraintDefs.size() > 0) { this.constraintRefs = new ArrayList<>(); this.constraints = new ArrayList<>(); for (ConstraintDefinition cd : constraintDefs) { if (cd.getRef() != null) { constraintRefs.add(cd.getRef().toPrefixString()); } else { constraints.add(new CustomModelConstraint(cd, messageLookup)); } } } }
Example 2
Source File: SolrFacetServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public List<PropertyDefinition> getFacetableProperties(QName contentClass) { final List<PropertyDefinition> result = new ArrayList<>(); final Map<QName, PropertyDefinition> propertyDefs = dictionaryService.getPropertyDefs(contentClass); if (propertyDefs != null) { for (final Map.Entry<QName, PropertyDefinition> prop : propertyDefs.entrySet()) { final PropertyDefinition propDef = prop.getValue(); if (propDef.isIndexed()) //SHA-1308 { final Facetable propIsFacetable = propDef.getFacetable(); switch (propIsFacetable) { case TRUE: result.add(propDef); break; case FALSE: // The value is not facetable. Do nothing. break; case UNSET: // These values may be facetable. final DataTypeDefinition datatype = propDef.getDataType(); if (isNumeric(datatype) || isDateLike(datatype) || isFacetableText(datatype)) { result.add(propDef); break; } break; default: // This should never happen. If it does, it's a programming error. throw new IllegalStateException("Failed to handle " + Facetable.class.getSimpleName() + " type: " + propIsFacetable); } } } } return result; }
Example 3
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
public String getAlfrescoPropertyFromSchemaField(String schemaField) { int index = schemaField.lastIndexOf("@{"); if(index == -1) { return schemaField; } String alfrescoQueryField = schemaField.substring(index+1); QName qName = QName.createQName(alfrescoQueryField); alfrescoQueryField = qName.toPrefixString(namespaceDAO); PropertyDefinition propertyDefinition = getPropertyDefinition(qName); if((propertyDefinition == null)) { return alfrescoQueryField; } if(!propertyDefinition.isIndexed() && !propertyDefinition.isStoredInIndex()) { return alfrescoQueryField; } DataTypeDefinition dataTypeDefinition = propertyDefinition.getDataType(); if(dataTypeDefinition.getName().equals(DataTypeDefinition.CONTENT)) { if(schemaField.contains("__size@")) { return alfrescoQueryField + ".size"; } else if(schemaField.contains("__locale@")) { return alfrescoQueryField + ".locale"; } else if(schemaField.contains("__mimetype@")) { return alfrescoQueryField + ".mimetype"; } else if(schemaField.contains("__encoding@")) { return alfrescoQueryField + ".encoding"; } else if(schemaField.contains("__docid@")) { return alfrescoQueryField + ".docid"; } else if(schemaField.contains("__tr_ex@")) { return alfrescoQueryField + ".tr_ex"; } else if(schemaField.contains("__tr_time@")) { return alfrescoQueryField + ".tr_time"; } else if(schemaField.contains("__tr_status@")) { return alfrescoQueryField + ".tr_status"; } else { return alfrescoQueryField; } } else { return alfrescoQueryField; } }
Example 4
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
public IndexedField getIndexedFieldForSpecializedPropertyMetadata(QName propertyQName, SpecializedFieldType type) { IndexedField indexedField = new IndexedField(); PropertyDefinition propertyDefinition = getPropertyDefinition(propertyQName); if((propertyDefinition == null)) { return indexedField; } if(!propertyDefinition.isIndexed() && !propertyDefinition.isStoredInIndex()) { return indexedField; } DataTypeDefinition dataTypeDefinition = propertyDefinition.getDataType(); if(dataTypeDefinition.getName().equals(DataTypeDefinition.CONTENT)) { StringBuilder builder = new StringBuilder(); builder.append(dataTypeDefinition.getName().getLocalName()); builder.append('@'); // TODO wher we support multi value propertis correctly .... builder.append(propertyDefinition.isMultiValued() ? "m" : "s"); builder.append('s'); builder.append("_"); builder.append('_'); switch (type) { case CONTENT_DOCID: builder.append("docid"); break; case CONTENT_ENCODING: builder.append("encoding"); break; case CONTENT_LOCALE: builder.append("locale"); break; case CONTENT_MIMETYPE: builder.append("mimetype"); break; case CONTENT_SIZE: builder.append("size"); break; case TRANSFORMATION_EXCEPTION: builder.append("tr_ex"); break; case TRANSFORMATION_STATUS: builder.append("tr_status"); break; case TRANSFORMATION_TIME: builder.append("tr_time"); break; default: break; } builder.append('@'); builder.append(propertyQName); indexedField.addField(builder.toString(), false, false); } else if (isDateOrDatetime(dataTypeDefinition)) { String dateDerivedSuffix = getDateDerivedSuffix(type); if (dateDerivedSuffix != null) { indexedField.addField(getDateDerivedField(propertyQName, dateDerivedSuffix), false, true); } } return indexedField; }
Example 5
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
public IndexedField getQueryableFields(QName propertyQName, SpecializedFieldType type, FieldUse fieldUse) { if(type != null) { return getIndexedFieldForSpecializedPropertyMetadata(propertyQName, type); } IndexedField indexedField = new IndexedField(); PropertyDefinition propertyDefinition = getPropertyDefinition(propertyQName); if((propertyDefinition == null)) { indexedField.addField("_dummy_", false, false); return indexedField; } if(!propertyDefinition.isIndexed() && !propertyDefinition.isStoredInIndex()) { indexedField.addField("_dummy_", false, false); return indexedField; } if(isTextField(propertyDefinition)) { switch(fieldUse) { case COMPLETION: addCompletionFields(propertyDefinition, indexedField); break; case FACET: addFacetSearchFields(propertyDefinition, indexedField); break; case FTS: addFullTextSearchFields(propertyDefinition, indexedField); break; case ID: addIdentifierSearchFields(propertyDefinition, indexedField); break; case EXACT: addExactSearchFields(propertyDefinition, indexedField); break; case MULTI_FACET: addMultiSearchFields(propertyDefinition, indexedField); break; case SORT: addSortSearchFields(propertyDefinition, indexedField); break; case STATS: addStatsSearchFields(propertyDefinition, indexedField); break; case SUGGESTION: if(isSuggestable(propertyQName)) { indexedField.addField("suggest", false, false); } addCompletionFields(propertyDefinition, indexedField); break; case HIGHLIGHT: addHighlightSearchFields(propertyDefinition, indexedField); break; } } else { indexedField.addField(getFieldForNonText(propertyDefinition), false, false); } return indexedField; }
Example 6
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
/** * Get all the field names into which we must copy the source data * * @param propertyQName QName * @return IndexedField */ public IndexedField getIndexedFieldNamesForProperty(QName propertyQName) { // TODO: Cache and throw on model refresh IndexedField indexedField = new IndexedField(); PropertyDefinition propertyDefinition = getPropertyDefinition(propertyQName); if((propertyDefinition == null)) { return indexedField; } if(!propertyDefinition.isIndexed() && !propertyDefinition.isStoredInIndex()) { return indexedField; } DataTypeDefinition dataTypeDefinition = propertyDefinition.getDataType(); if(isTextField(propertyDefinition)) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.TRUE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { indexedField.addField(getFieldForText(true, true, false, propertyDefinition), true, false); if(crossLocaleSearchDataTypes.contains(propertyDefinition.getDataType().getName()) || crossLocaleSearchProperties.contains(propertyDefinition.getName())) { indexedField.addField(getFieldForText(false, true, false, propertyDefinition), false, false); } } if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH || isIdentifierTextProperty(propertyDefinition.getName()))) { indexedField.addField(getFieldForText(true, false, false, propertyDefinition), true, false); indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } if(dataTypeDefinition.getName().equals(DataTypeDefinition.TEXT)) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { if(!propertyDefinition.isMultiValued()) { indexedField.addField(getFieldForText(false, false, true, propertyDefinition), false, true); } } else if (!isIdentifierTextProperty(propertyDefinition.getName())) { if(propertyDefinition.getFacetable() == Facetable.TRUE) { indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } } } if(dataTypeDefinition.getName().equals(DataTypeDefinition.MLTEXT)) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { if(!propertyDefinition.isMultiValued()) { indexedField.addField(getFieldForText(true, false, true, propertyDefinition), true, true); } } } if(isSuggestable(propertyQName)) { indexedField.addField("suggest_@" + propertyDefinition.getName().toString(), false, false); } } else { indexedField.addField(getFieldForNonText(propertyDefinition), false, false); } return indexedField; }