Java Code Examples for org.alfresco.service.cmr.dictionary.PropertyDefinition#getIndexTokenisationMode()
The following examples show how to use
org.alfresco.service.cmr.dictionary.PropertyDefinition#getIndexTokenisationMode() .
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 | 6 votes |
private void addFullTextSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField) { if (((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.TRUE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) && !isIdentifierTextProperty(propertyDefinition.getName())) { 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); } } else { indexedField.addField(getFieldForText(true, false, false, propertyDefinition), true, false); indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } }
Example 2
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
private void addIdentifierSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { indexedField.addField(getFieldForText(true, false, false, propertyDefinition), true, false); indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } else { 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); } } }
Example 3
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
private void addExactSearchFields(PropertyDefinition propertyDefinition, IndexedField indexedField) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || !(propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { indexedField.addField(getFieldForText(true, false, false, propertyDefinition), true, false); 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{ throw new UnsupportedOperationException("Exact Term search is not supported unless you configure the field <"+propertyDefinition.getName()+"> for cross locale search"); } } }
Example 4
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
private void addMultiSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField) { 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 5
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
private void addCompletionFields(PropertyDefinition propertyDefinition, IndexedField indexedField) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { 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); } } else if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.TRUE)) { 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); } } else if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE)) { indexedField.addField(getFieldForText(false, false, false, propertyDefinition), false, false); } }
Example 6
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 7
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 8
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 9
Source File: AlfrescoFunctionEvaluationContext.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 4 votes |
public <Q, S, E extends Throwable> String getLuceneSortField(LuceneQueryParserAdaptor<Q, S, E> lqpa, String propertyName) throws E { // Score is special if (propertyName.equalsIgnoreCase("Score")) { return "Score"; } String field = getLuceneFieldName(propertyName); // need to find the real field to use if (field.startsWith(QueryConstants.PROPERTY_FIELD_PREFIX)) { PropertyDefinition propertyDef = dictionaryService.getProperty(QName.createQName(field.substring(1))); // Handle .size and .mimetype if(propertyDef == null) { if(field.endsWith(QueryConstants.FIELD_SIZE_SUFFIX)) { propertyDef = dictionaryService.getProperty(QName.createQName(field.substring(1, field.length()-QueryConstants.FIELD_SIZE_SUFFIX.length()))); if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)) { throw new FTSQueryException("Order for "+QueryConstants.FIELD_SIZE_SUFFIX+" only supported on content properties"); } else { return field; } } else if (field.endsWith(QueryConstants.FIELD_MIMETYPE_SUFFIX)) { propertyDef = dictionaryService.getProperty(QName.createQName(field.substring(1, field.length()-QueryConstants.FIELD_MIMETYPE_SUFFIX.length()))); if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)) { throw new FTSQueryException("Order for .mimetype only supported on content properties"); } else { return field; } } else { return field; } } else { if (propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)) { throw new FTSQueryException("Order on content properties is not curently supported"); } else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.TEXT)) { if(propertyDef.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) { return field; } String noLocalField = field+".no_locale"; if(lqpa.sortFieldExists(noLocalField)) { return noLocalField; } field = findSortField(lqpa, field); } else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT)) { field = findSortField(lqpa, field); } else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) { field = lqpa.getDatetimeSortField(field, propertyDef); } } } return field; }
Example 10
Source File: AlfrescoSolrDataModel.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
private void addSortSearchFields( PropertyDefinition propertyDefinition , IndexedField indexedField) { // Can only order on single valued fields DataTypeDefinition dataTypeDefinition = propertyDefinition.getDataType(); if(dataTypeDefinition.getName().equals(DataTypeDefinition.TEXT)) { if(!propertyDefinition.isMultiValued()) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { indexedField.addField(getFieldForText(false, false, true, propertyDefinition), false, true); } else if (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); } } } } if(dataTypeDefinition.getName().equals(DataTypeDefinition.MLTEXT)) { if(!propertyDefinition.isMultiValued()) { if ((propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.FALSE) || (propertyDefinition.getIndexTokenisationMode() == IndexTokenisationMode.BOTH)) { indexedField.addField(getFieldForText(false, false, true, propertyDefinition), false, true); } 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 11
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; }