mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
SEARCH-2296: Add new "_unit_of_time_quarter" date part field. (#267)
This commit is contained in:
@@ -191,6 +191,8 @@ public interface QueryConstants
|
|||||||
|
|
||||||
public static final String FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX = "_unit_of_time_month";
|
public static final String FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX = "_unit_of_time_month";
|
||||||
|
|
||||||
|
public static final String FIELD_SOLR_UNIT_OF_TIME_QUARTER_SUFFIX = "_unit_of_time_quarter";
|
||||||
|
|
||||||
public static final String FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX = "_unit_of_time_year";
|
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_SITE = "SITE";
|
||||||
|
@@ -409,6 +409,11 @@ public class QueryParserUtils implements QueryConstants
|
|||||||
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX.length());
|
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;
|
ending = FIELD_SOLR_UNIT_OF_TIME_MONTH_SUFFIX;
|
||||||
}
|
}
|
||||||
|
else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_QUARTER_SUFFIX))
|
||||||
|
{
|
||||||
|
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_QUARTER_SUFFIX.length());
|
||||||
|
ending = FIELD_SOLR_UNIT_OF_TIME_QUARTER_SUFFIX;
|
||||||
|
}
|
||||||
else if (field.endsWith(FIELD_SOLR_UNIT_OF_TIME_YEAR_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());
|
propertyFieldName = field.substring(field.startsWith("@") ? 1 : 0, field.length() - FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX.length());
|
||||||
|
@@ -566,6 +566,20 @@ public class AlfrescoFunctionEvaluationContext implements FunctionEvaluationCont
|
|||||||
return propertyField;
|
return propertyField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_QUARTER_SUFFIX))
|
||||||
|
{
|
||||||
|
QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_QUARTER_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_QUARTER_SUFFIX+" only supported on date and datetime properties");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return propertyField;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(field.endsWith(QueryConstants.FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX))
|
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()));
|
QName propertyField = QName.createQName(field.substring(0, field.length() - QueryConstants.FIELD_SOLR_UNIT_OF_TIME_YEAR_SUFFIX.length()));
|
||||||
|
Reference in New Issue
Block a user