public static Query parse(String[] queries, String[] fields, Analyzer analyzer)throws QueryNodeException {if (queries.length != fields.length)throw new IllegalArgumentException("queries.length != fields.length");BooleanQuery.Builder bQuery = new BooleanQuery.Builder();StandardQueryParser qp = new StandardQueryParser();qp.setAnalyzer(analyzer);for (int i = 0; i < fields.length; i++) {Query q = qp.parse(queries[i], fields[i]);if (q != null) { bQuery.add(q, BooleanClause.Occur.SHOULD);}}return bQuery.build();}
public static Query Parse(string[] queries, string[] fields, Analyzer analyzer){if (queries.Length != fields.Length)throw new ArgumentException("queries.length != fields.length");BooleanQuery bQuery = new BooleanQuery();StandardQueryParser qp = new StandardQueryParser();qp.Analyzer = analyzer;for (int i = 0; i < fields.Length; i++){Query q = qp.Parse(queries[i], fields[i]);if (q != null && (!(q is BooleanQuery) || ((BooleanQuery)q).Clauses.Count > 0)){bQuery.Add(q, Occur.SHOULD);}}return bQuery;}