cancel
Showing results for 
Search instead for 
Did you mean: 

a piece of advice for LuceneAnalyzer

dream_zh
Champ in-the-making
Champ in-the-making
public LuceneAnalyser(DictionaryService dictionaryService)
    {
        this(new StandardAnalyzer());
        this.dictionaryService = dictionaryService;
    }
can you change this line (this(new StandardAnalyzer()):smileywink:in this method ?can you change the onfigurable value ??

add bellow line in line 218 of  LuceneSearcherImpl.java
System.out.println(parameterisedQueryString);
i found there is "*";
why??
3 REPLIES 3

andy
Champ on-the-rise
Champ on-the-rise
Hi

LuceneAnaylser: There is a case missing here, the standard anayser should only be used for some internal index fields. The issue is that it is being used for the internal TEXT field which should be treated the same as the TEXT type.

http://www.alfresco.org/jira/browse/AR-503

I can not find the other line of code. It sounds like it is commented out to me. Which version do you have?

Regards

Andy

dream_zh
Champ in-the-making
Champ in-the-making
I hope that the class of all analyzers  can be configurable!!it is very good.

i found there is "*"  before the query words!!  why??

System.out.println(parameterisedQueryString);
the code is added by me!!
there is "*"  in  parameterisedQueryString???


in the fdataTypeAnalyzers.properties :

d_dictionary.datatype.d_any.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_int.analyzer=org.alfresco.repo.search.impl.lucene.analysis.IntegerAnalyser
d_dictionary.datatype.d_long.analyzer=org.alfresco.repo.search.impl.lucene.analysis.LongAnalyser
d_dictionary.datatype.d_float.analyzer=org.alfresco.repo.search.impl.lucene.analysis.FloatAnalyser
d_dictionary.datatype.d_double.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DoubleAnalyser
d_dictionary.datatype.d_date.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
d_dictionary.datatype.d_datetime.analyzer=org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser
d_dictionary.datatype.d_boolean.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_qname.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_guid.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_category.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_noderef.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
d_dictionary.datatype.d_path.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer
can all configures  take effect??



please look at below codes:

        Analyzer analyser;
        if (fieldName.equals("PATH"))
        {
            analyser = new PathAnalyser();
        }
        else if (fieldName.equals("QNAME"))
        {
            analyser = new PathAnalyser();
        }
        else if (fieldName.equals("TYPE"))
        {
            throw new UnsupportedOperationException("TYPE must not be tokenised");
        }
        else if (fieldName.equals("ASPECT"))
        {
            throw new UnsupportedOperationException("ASPECT must not be tokenised");
        }
        else if (fieldName.equals("ANCESTOR"))
        {
            analyser = new WhitespaceAnalyzer();
        }
        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);
            }
        }
        else
        {
            analyser = defaultAnalyser;
        }
        analysers.put(fieldName, analyser);
        return analyser;

andy
Champ on-the-rise
Champ on-the-rise
Hi

Fixing the TEXT issue at the moment …

the lines

DataTypeDefinition dataType = (propertyDef == null) ? dictionaryService.getDataType(DataTypeDefinition.TEXT) : propertyDef.getDataType(); 
String analyserClassName = dataType.getAnalyserClassName();

The first line extracts the data type, falling back to text; the second line gets the analyser using the locale of the server.

Regards

Andy
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.