diff --git a/src/main/java/org/alfresco/repo/search/adaptor/lucene/QueryConstants.java b/src/main/java/org/alfresco/repo/search/adaptor/lucene/QueryConstants.java index f53d080fb9..ba5faf3e5d 100644 --- a/src/main/java/org/alfresco/repo/search/adaptor/lucene/QueryConstants.java +++ b/src/main/java/org/alfresco/repo/search/adaptor/lucene/QueryConstants.java @@ -181,18 +181,6 @@ public interface QueryConstants public static final String FIELD_SOLR_NOLOCALE_TOKENISED_SUFFIX = ".__"; - public static final String FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX = "_unit_of_time_second"; - - public static final String FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX = "_unit_of_time_minute"; - - public static final String FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX = "_unit_of_time_hour"; - - public static final String FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX = "_unit_of_time_day"; - - public static final String FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX = "_unit_of_time_month"; - - public static final String FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX = "_unit_of_time_year"; - public static final String FIELD_SITE = "SITE"; public static final String FIELD_GEO = "GEO"; diff --git a/src/main/java/org/alfresco/repo/search/impl/QueryParserUtils.java b/src/main/java/org/alfresco/repo/search/impl/QueryParserUtils.java index e36fb76b94..df50966487 100644 --- a/src/main/java/org/alfresco/repo/search/impl/QueryParserUtils.java +++ b/src/main/java/org/alfresco/repo/search/impl/QueryParserUtils.java @@ -384,36 +384,6 @@ public class QueryParserUtils implements QueryConstants propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_NOLOCALE_TOKENISED_SUFFIX.length()); ending = FIELD_SOLR_NOLOCALE_TOKENISED_SUFFIX; } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX; - } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX; - } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX; - } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX; - } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX; - } - else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX)) - { - propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX.length()); - ending = FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX; - } else { propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0); diff --git a/src/main/java/org/alfresco/repo/search/impl/parsers/AlfrescoFunctionEvaluationContext.java b/src/main/java/org/alfresco/repo/search/impl/parsers/AlfrescoFunctionEvaluationContext.java index dee38088b8..f929f81901 100644 --- a/src/main/java/org/alfresco/repo/search/impl/parsers/AlfrescoFunctionEvaluationContext.java +++ b/src/main/java/org/alfresco/repo/search/impl/parsers/AlfrescoFunctionEvaluationContext.java @@ -499,87 +499,6 @@ public class AlfrescoFunctionEvaluationContext implements FunctionEvaluationCont return propertyField; } } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_SECOND_SUFFIX+" only supported on datetime properties"); - } - else - { - return propertyField; - } - } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MINUTE_SUFFIX+" only supported on datetime properties"); - } - else - { - return propertyField; - } - } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_HOUR_SUFFIX+" only supported on datetime properties"); - } - else - { - return propertyField; - } - } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATE) && - !propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_DAY_SUFFIX+" only supported on date and datetime properties"); - } - else - { - return propertyField; - } - } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATE) && - !propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX+" only supported on date and datetime properties"); - } - else - { - return propertyField; - } - } - else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX)) - { - QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX.length())); - PropertyDefinition propertyDef = dictionaryService.getProperty(propertyField); - if (!propertyDef.getDataType().getName().equals(DataTypeDefinition.DATE) && - !propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME)) - { - throw new FTSQueryException(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX+" only supported on date and datetime properties"); - } - else - { - return propertyField; - } - } else { return qname;