Is there any builder for the XMLQueryParser so that we don't need to build as a String?
And what query DSL are you referring to? ---- On Mon, 02 Dec 2019 08:00:57 -1100 m...@apache.org wrote ---- and Query DSL as well. Although, it didn't get the point in the topic starter. On Mon, Dec 2, 2019 at 9:16 PM Alexandre Rafalovitch <arafa...@gmail.com> wrote: > What about XMLQueryParser: > > https://lucene.apache.org/solr/guide/8_2/other-parsers.html#xml-query-parser > > Regards, > Alex. > > On Wed, 27 Nov 2019 at 22:43, <em...@yeikel.com> wrote: > > > > I am trying to simulate the following query(Lucene query builder) using > Solr > > > > > > > > > > BooleanQuery.Builder main = new BooleanQuery.Builder(); > > > > Term t1 = new Term("f1","term"); > > Term t2 = new Term("f1","second"); > > Term t3 = new Term("f1","another"); > > > > BooleanQuery.Builder q1 = new BooleanQuery.Builder(); > > q1.add(new FuzzyQuery(t1,2), BooleanClause.Occur.SHOULD); > > q1.add(new FuzzyQuery(t2,2), BooleanClause.Occur.SHOULD); > > q1.add(new FuzzyQuery(t3,2), BooleanClause.Occur.SHOULD); > > q1.setMinimumNumberShouldMatch(2); > > > > Term t4 = new Term("f1","anothert"); > > Term t5 = new Term("f1","anothert2"); > > Term t6 = new Term("f1","anothert3"); > > > > BooleanQuery.Builder q2 = new BooleanQuery.Builder(); > > q2.add(new FuzzyQuery(t4,2), BooleanClause.Occur.SHOULD); > > q2.add(new FuzzyQuery(t5,2), BooleanClause.Occur.SHOULD); > > q2.add(new FuzzyQuery(t6,2), BooleanClause.Occur.SHOULD); > > q2.setMinimumNumberShouldMatch(2); > > > > > > main.add(q1.build(),BooleanClause.Occur.SHOULD); > > main.add(q2.build(),BooleanClause.Occur.SHOULD); > > main.setMinimumNumberShouldMatch(1); > > > > System.out.println(main.build()); // (((f1:term~2 f1:second~2 > > f1:another~2)~2) ((f1:anothert~2 f1:anothert2~2 f1:anothert3~2)~2))~1 > --> > > Invalid Solr Query > > > > > > > > > > > > In a few words : ( q1 OR q2 ) > > > > > > > > Where q1 and q2 are a set of different terms using I'd like to do a fuzzy > > search but I also need a minimum of terms to match. > > > > > > > > The best I was able to create was something like this : > > > > > > > > SolrQuery query = new SolrQuery(); > > query.set("fl", "term"); > > query.set("q", "term~1 term2~2 term3~2"); > > query.set("mm",2); > > > > System.out.println(query); > > > > > > > > And I was unable to find any example that would allow me to do the type > of > > query that I am trying to build with only one solr query. > > > > > > > > Is it possible to use the Lucene Query builder with Solr? Is there any > way > > to create Boolean queries with Solr? Do I need to build the query as a > > String? If so , how do I set the mm parameter in a String query? > > > > > > > > Thank you > > > -- Sincerely yours Mikhail Khludnev