mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
This reverts commit bf0628be6a
.
This commit is contained in:
@@ -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";
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user