On 04/05/2011 07:56, Israel Tsadok wrote:

On Tue, May 3, 2011 at 7:03 PM, Paul Taylor <paul_t...@fastmail.fm <mailto:paul_t...@fastmail.fm>> wrote:

    We subclassed  PerFieldAnalyzerWrapper as follows:

    public class PerFieldEntityAnalyzer extends PerFieldAnalyzerWrapper {

       public PerFieldEntityAnalyzer(Class indexFieldClass) {
           super(new StandardUnaccentAnalyzer());

           for(Object o : EnumSet.allOf(indexFieldClass)) {
               IndexField indexField = (IndexField) o;
               Analyzer analyzer = indexField.getAnalyzer();
               if (analyzer != null) {
                   this.addAnalyzer(indexField.getName(), analyzer);
               }
           }
       }
    }

    but now we cant do this.

How about:

public static Analyzer createPerFieldEntityAnalyzer(Class indexFieldClass) { PerFieldAnalyzerWrapper wrapper = new PerFieldAnalyzerWrapper(new StandardUnaccentAnalyzer());

    for(Object o : EnumSet.allOf(indexFieldClass)) {
        IndexField indexField = (IndexField) o;
        Analyzer analyzer = indexField.getAnalyzer();
        if (analyzer != null) {
            wrapper.addAnalyzer(indexField.getName(), analyzer);
        }
    }

    return wrapper;
}

I'm pretty sure that's how you're supposed to use it anyway.
Yeah, actually I independentently ended up doing that, so not a big deal, thanks.

Paul

Reply via email to