Merged HEAD-BUG-FIX (Cloud33/4.3) to HEAD (Cloud33/4.3)

62915: Merged PLATFORM1 (Cloud33) to HEAD-BUG-FIX (Cloud33/4.3)
      62288: ACE-479  Provide Search Adapter - general tidy up including addressing the review comments


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62969 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-20 14:33:04 +00:00
parent 50b79beee2
commit e245353b4a
22 changed files with 25 additions and 218 deletions

View File

@@ -19,12 +19,7 @@
package org.alfresco.cmis.mapping;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import org.alfresco.repo.search.MLAnalysisMode;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParserAdaptor;
import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser;
import org.alfresco.service.ServiceRegistry;
@@ -35,7 +30,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.namespace.QName;
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* A simple 1-1 property mapping from a CMIS property name to an alfresco property
@@ -94,7 +88,6 @@ public class DirectProperty extends AbstractSimpleProperty
String field = getLuceneFieldName();
// need to find the real field to use
Locale sortLocale = null;
PropertyDefinition propertyDef = getServiceRegistry().getDictionaryService().getProperty(QName.createQName(field.substring(1)));
@@ -104,63 +97,7 @@ public class DirectProperty extends AbstractSimpleProperty
}
else if ((propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT)) || (propertyDef.getDataType().getName().equals(DataTypeDefinition.TEXT)))
{
// List<Locale> locales = lqpa.getSearchParameters().getLocales();
// if (((locales == null) || (locales.size() == 0)))
// {
// locales = Collections.singletonList(I18NUtil.getLocale());
// }
//
// if (locales.size() > 1)
// {
// throw new CmisInvalidArgumentException("Order on text/mltext properties with more than one locale is not curently supported");
// }
//
// sortLocale = locales.get(0);
// // find best field match
//
// HashSet<String> allowableLocales = new HashSet<String>();
// MLAnalysisMode analysisMode = lqpa.getDefaultSearchMLAnalysisMode();
// for (Locale l : MLAnalysisMode.getLocales(analysisMode, sortLocale, false))
// {
// allowableLocales.add(l.toString());
// }
field = lqpa.getSortField(field);
// String sortField = field;
//
// for (Object current : lqp.getIndexReader().getFieldNames(FieldOption.INDEXED))
// {
// String currentString = (String) current;
// if (currentString.startsWith(field) && currentString.endsWith(".sort"))
// {
// String fieldLocale = currentString.substring(field.length() + 1, currentString.length() - 5);
// if (allowableLocales.contains(fieldLocale))
// {
// if (fieldLocale.equals(sortLocale.toString()))
// {
// sortField = currentString;
// break;
// }
// else if (sortLocale.toString().startsWith(fieldLocale))
// {
// if (sortField.equals(field) || (currentString.length() < sortField.length()))
// {
// sortField = currentString;
// }
// }
// else if (fieldLocale.startsWith(sortLocale.toString()))
// {
// if (sortField.equals(field) || (currentString.length() < sortField.length()))
// {
// sortField = currentString;
// }
// }
// }
// }
// }
//
// field = sortField;
}
else if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DATETIME))
{
@@ -174,74 +111,6 @@ public class DirectProperty extends AbstractSimpleProperty
return field;
}
/**
* @param lqp
* @param field
* @return
*/
// private <Q, S, E extends Throwable> String findSortField(LuceneQueryParserAdaptor<Q, S, E> lqpa, String field)
// {
// Locale sortLocale;
// List<Locale> locales = lqpa.getSearchParameters().getLocales();
// if (((locales == null) || (locales.size() == 0)))
// {
// locales = Collections.singletonList(I18NUtil.getLocale());
// }
//
// if (locales.size() > 1)
// {
// throw new SearcherException("Order on text/mltext properties with more than one locale is not curently supported");
// }
//
// sortLocale = locales.get(0);
// // find best field match
//
// HashSet<String> allowableLocales = new HashSet<String>();
// MLAnalysisMode analysisMode = lqpa.getDefaultSearchMLAnalysisMode();
// for (Locale l : MLAnalysisMode.getLocales(analysisMode, sortLocale, false))
// {
// allowableLocales.add(l.toString());
// }
//
// field = lqpa.getSortField(field);
//
// String sortField = field;
//
// for (Object current : lqp.getIndexReader().getFieldNames(FieldOption.INDEXED))
// {
// String currentString = (String) current;
// if (currentString.startsWith(field) && currentString.endsWith(".sort"))
// {
// String fieldLocale = currentString.substring(field.length() + 1, currentString.length() - 5);
// if (allowableLocales.contains(fieldLocale))
// {
// if (fieldLocale.equals(sortLocale.toString()))
// {
// sortField = currentString;
// break;
// }
// else if (sortLocale.toString().startsWith(fieldLocale))
// {
// if (sortField.equals(field) || (currentString.length() < sortField.length()))
// {
// sortField = currentString;
// }
// }
// else if (fieldLocale.startsWith(sortLocale.toString()))
// {
// if (sortField.equals(field) || (currentString.length() < sortField.length()))
// {
// sortField = currentString;
// }
// }
// }
// }
// }
//
// field = sortField;
// return field;
// }
private QName alfrescoName;
/**