Merge V1.2.0 BRANCH to HEAD

svn merge -r 2519:2565 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2566 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-03-22 12:23:43 +00:00
parent 9fe16d5ae3
commit 506e408ca7
29 changed files with 725 additions and 182 deletions

View File

@@ -108,29 +108,17 @@ public class LuceneAnalyser extends Analyzer
{
analyser = new WhitespaceAnalyzer();
}
else if (fieldName.equals("TEXT"))
{
DataTypeDefinition dataType = dictionaryService.getDataType(DataTypeDefinition.TEXT);
analyser = loadAnalyzer(dataType);
}
else if (fieldName.startsWith("@"))
{
QName propertyQName = QName.createQName(fieldName.substring(1));
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
DataTypeDefinition dataType = (propertyDef == null) ? dictionaryService.getDataType(DataTypeDefinition.TEXT) : propertyDef.getDataType();
String analyserClassName = dataType.getAnalyserClassName();
try
{
Class<?> clazz = Class.forName(analyserClassName);
analyser = (Analyzer)clazz.newInstance();
}
catch (ClassNotFoundException e)
{
throw new RuntimeException("Unable to load analyser for property " + fieldName.substring(1) + " of type " + dataType.getName() + " using " + analyserClassName);
}
catch (InstantiationException e)
{
throw new RuntimeException("Unable to load analyser for property " + fieldName.substring(1) + " of type " + dataType.getName() + " using " + analyserClassName);
}
catch (IllegalAccessException e)
{
throw new RuntimeException("Unable to load analyser for property " + fieldName.substring(1) + " of type " + dataType.getName() + " using " + analyserClassName);
}
analyser = loadAnalyzer(dataType);
}
else
{
@@ -139,4 +127,28 @@ public class LuceneAnalyser extends Analyzer
analysers.put(fieldName, analyser);
return analyser;
}
private Analyzer loadAnalyzer(DataTypeDefinition dataType)
{
String analyserClassName = dataType.getAnalyserClassName();
try
{
Class<?> clazz = Class.forName(analyserClassName);
Analyzer analyser = (Analyzer)clazz.newInstance();
return analyser;
}
catch (ClassNotFoundException e)
{
throw new RuntimeException("Unable to load analyser for property of type " + dataType.getName() + " using " + analyserClassName);
}
catch (InstantiationException e)
{
throw new RuntimeException("Unable to load analyser for property of type " + dataType.getName() + " using " + analyserClassName);
}
catch (IllegalAccessException e)
{
throw new RuntimeException("Unable to load analyser for property of type " + dataType.getName() + " using " + analyserClassName);
}
}
}