Merge pull request #8 from Alfresco/feature/SEARCH-679

Feature/search 679
This commit is contained in:
Michael
2018-01-22 12:15:21 +00:00
committed by GitHub
2 changed files with 23 additions and 5 deletions
@@ -1940,7 +1940,13 @@ public class AlfrescoSolrDataModel implements QueryConstants
ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
return contextAwareQuery;
}
private PropertyDefinition getPropertyDefinition(String identifier)
{
return QueryParserUtils.matchPropertyDefinition(NamespaceService.CONTENT_MODEL_1_0_URI,
getNamespaceDAO(),
getDictionaryService(CMISStrictDictionaryService.DEFAULT),
identifier);
}
/**
*
* @param potentialProperty String
@@ -1976,9 +1982,17 @@ public class AlfrescoSolrDataModel implements QueryConstants
Pair<String, String> fieldNameAndEnding = QueryParserUtils.extractFieldNameAndEnding(potentialProperty);
String luceneField = functionContext.getLuceneFieldName(fieldNameAndEnding.getFirst());
PropertyDefinition propertyDef = QueryParserUtils.matchPropertyDefinition(NamespaceService.CONTENT_MODEL_1_0_URI, getNamespaceDAO(), getDictionaryService(CMISStrictDictionaryService.DEFAULT), fieldNameAndEnding.getFirst());
PropertyDefinition propertyDef = getPropertyDefinition(fieldNameAndEnding.getFirst());
//Retry scan using luceneField.
if(propertyDef == null)
{
if(luceneField.contains("@"))
{
int index = luceneField.lastIndexOf("@");
propertyDef = getPropertyDefinition(luceneField.substring(index +1));
}
}
String solrSortField = null;
if(propertyDef != null)
{
@@ -1926,7 +1926,11 @@ public class AlfrescoFTSQParserPluginTest extends LoadAFTSTestData implements Qu
null,
16,
new Integer[] { 3, 13, 4, 14, 11, 7, 8, 2, 10, 15, 5, 6, 16, 12, 9, 1 });
assertAQueryIsSorted("-eager or -dog",
"cm_name desc",
null,
16,
new Integer[] { 3, 13, 4, 14, 11, 7, 8, 2, 10, 15, 5, 6, 16, 12, 9, 1 });
assertAQueryIsSorted("-eager or -dog",
"@name asc",
null,