Java Code Examples for org.alfresco.service.cmr.dictionary.PropertyDefinition#getFacetable()
The following examples show how to use
org.alfresco.service.cmr.dictionary.PropertyDefinition#getFacetable() .
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: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
private void addFacetSearchFields(PropertyDefinition propertyDefinition, IndexedField indexedField) { if(propertyDefinition.getDataType().getName().equals(DataTypeDefinition.TEXT)) { if (!isIdentifierTextProperty(propertyDefinition.getName())) { if(propertyDefinition.getFacetable() == Facetable.TRUE) { indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } } } if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH) || isIdentifierTextProperty(propertyDefinition.getName())) { indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } else { if(crossLocaleSearchDataTypes.contains(propertyDefinition.getDataType().getName()) || crossLocaleSearchProperties.contains(propertyDefinition.getName())) { indexedField.addField(getFieldForText(false, true, false, propertyDefinition), false, false); } else { indexedField.addField(getFieldForText(true, true, false, propertyDefinition), false, false); } } }
Example 2
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
private boolean hasDocValues(PropertyDefinition propertyDefinition) { if(isTextField(propertyDefinition)) { // We only call this if text is untokenised and localised return propertyDefinition.getFacetable() != Facetable.FALSE; } else { if(propertyDefinition.getFacetable() == Facetable.FALSE) { return false; } else if(propertyDefinition.getFacetable() == Facetable.TRUE) { return true; } else { if(propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.TRUE) { return false; } else { return isPrimitive(propertyDefinition.getDataType()); } } } }
Example 3
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 4
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 5
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; }