Hi, Why not use PerFieldAnalyzerWrapper to provide the same thing and that's already available?
----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Rafał Lenarczyk [mailto:rafal.lenarczyk...@gmail.com] > Sent: Thursday, March 17, 2011 4:41 PM > To: java-user@lucene.apache.org > Subject: lucene > > Hy, > This mail should be written by developers. > > I'm java developer and use your product in my application. > I use special QueryParser like MultiFieldQueryParser I use static method > parse where I must set lucene Version, string tab with queries, string tab > with field, string tab with flags and analyzer: > MultiFieldQueryParser.parse(Version matchVersion, String[] queries, String[] > fields, BooleanClause.Occur[] flags, Analyzer analyzer) throws > ParseException; > > This implementation has one parameter analyzer, and I have differents fields > for example person name, person sname or person id sometimes. > I want use KeywordAnalyzer to person id and other Analyzer to person > name and sname. > I wrote my specjal MultiFieldQueryParser.parse: > > import org.apache.lucene.analysis.Analyzer; > import org.apache.lucene.queryParser.ParseException; > import org.apache.lucene.queryParser.QueryParser; > import org.apache.lucene.search.BooleanClause; > import org.apache.lucene.search.BooleanQuery; > import org.apache.lucene.search.Query; > import org.apache.lucene.util.Version; > > public class MyMultifieldQueryParser { > > public static Query parse(Version matchVersion, String[] queries, String[] > fields, BooleanClause.Occur[] flags, Analyzer[] analyzers) throws > ParseException { > if (!(queries.length == fields.length && queries.length == > flags.length)) > throw new IllegalArgumentException("queries, fields, and flags array > have have different length"); > BooleanQuery bQuery = new BooleanQuery(); > for (int i = 0; i < fields.length; i++) { > QueryParser qp = new QueryParser(matchVersion, fields[i], > analyzers[i]); //---------------------------this was changed > Query q = qp.parse(queries[i]); > if (q!=null && // q never null, just being defensive > (!(q instanceof BooleanQuery) || > ((BooleanQuery)q).getClauses().length>0)) { > bQuery.add(q, flags[i]); > } > } > return bQuery; > } > } > > I think It is good idea and You can add in your new release. > > Regards, > Rafal Lenarczyk --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org