[opencms-dev] Lucene 1.4, Spanish Analyzer

M Butcher mbutcher at grcomputing.net
Wed Nov 26 22:08:02 CET 2003


Hmmm... good question.... let me look at the code.


Here's the code from IndexManager, where anaName is the value for the 
<analyzer/> element.

         // Use a default if none is specified.
         if(anaName == null) {
             nlyz = new StandardAnalyzer();
             A_OpenCms.log(A_OpenCms.C_OPENCMS_INFO,
                 "Analyzer: StandardAnalyzer");
         } else {
             A_OpenCms.log(A_OpenCms.C_OPENCMS_INFO,
                 "Analyzer: " + anaName);
             try {
                 Class lx = Class.forName(anaName);
                 nlyz = (Analyzer)lx.newInstance();
             } catch (Exception e) {
                 throw new CmsException(
                     "Could not create analyzer with classname "+
                     anaName, e);
             }
         }

Since I'm using a dynamic class loader, everything gets called with 
newInstance() instead of the constructor, the assumption being that all 
analyzers have an empty constructor available.

To work around this without changing the module, you'd probably have to 
write a wrapper (something like SpanishSnowballAnalyzer) that 
initializes the SnowballAnalyzer the way you need. Extending 
SnowballAnalyzer may be the easiest, since all you'd have to add is the 
constructor.

Matt

Ernesto De Santis wrote:
> Thanks Matt.
> 
> Now, i need change my registry.
> the constructor of SnowballAnalyzer is
> 
> public SnowballAnalyzer(String name) {
>     this.name = name;
> }
> I need send the parameter name in the registry.
> How to make this?
> 
>             <analyzer>org.apache.lucene.analysis.standard.SnowballAnalyzer
>                      <????>Spanish<????/>
>             </analyzer>
> 
> Thanks again.
> Ernesto.
> 
> 
> ----- Original Message -----
> From: "M Butcher" <mbutcher at grcomputing.net>
> To: <opencms-dev at opencms.org>
> Sent: Wednesday, November 26, 2003 5:07 PM
> Subject: Re: [opencms-dev] Lucene 1.4, Spanish Analyzer
> 
> 
> 
> AFAIK, the Spanish analyzer is in the SnowballAnalyzers package at
> jakarta.apache.com/lucene.
> 
> They have binaries here:
> 
> http://jakarta.apache.org/lucene/docs/lucene-sandbox/snowball/
> 
> I've never used these, since my content is in English. Please tell me if
> you have any trouble using them with the Lucene module.
> 
> Matt
> 
> Ernesto De Santis wrote:
> 
>>Hi Matt and all.
>>
>>I need the SpanishAnalyzer.
>>
>>I search in the urlĀ“s that you post, and in lucene-sandbox, but not find
>>this class.
>>
>>Where I can find this?
>>
>>bye,
>>Ernesto
>>
>>----- Original Message -----
>>From: "M Butcher" <mbutcher at grcomputing.net>
>>To: <opencms-dev at opencms.org>
>>Sent: Friday, November 14, 2003 3:31 PM
>>Subject: Re: [opencms-dev] Lucene 1.4, Spanish Analyzer and Word/PDF
>>extractor
>>
>>
>>
>>
>>>The Lucene 1.4 module is currently in the "contribs" section at
>>>http://aleph-null.tv
>>>
>>>The direct URL is:
>>>http://aleph-null.tv/htmlArticle.php?doc=20031022-1630-773.xml
>>>
>>>The 1.4 version will be the basis of all future versions, so while it is
>>>listed as a "contrib", it's the main release we're working from.
>>>
>>>Ernesto created the Word/PDF code, and will post it to the list shortly
>>>(I hope).
>>>
>>>Matt
>>>
>>>
>>>1JOMATO wrote:
>>>
>>>
>>>>Can anybody tell me where can I get the Lucene Search Module 1.4, an
>>>>Spanish Analyzer, and a Word/PDF extractor for Lucene.
>>>>Thanks.
>>>>
>>>>
>>>>_______________________________________________
>>>>This mail is send to you from the opencms-dev mailing list
>>>>To change your list options, or to unsubscribe from the list, please
>>
>>visit
>>
>>
>>>>http://mail.opencms.org/mailman/listinfo/opencms-dev
>>>
>>>
>>>_______________________________________________
>>>This mail is send to you from the opencms-dev mailing list
>>>To change your list options, or to unsubscribe from the list, please visit
>>>http://mail.opencms.org/mailman/listinfo/opencms-dev
>>>
>>>
>>
>>
>>_______________________________________________
>>This mail is send to you from the opencms-dev mailing list
>>To change your list options, or to unsubscribe from the list, please visit
>>http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev





More information about the opencms-dev mailing list