I have a query -license:"CC-BY-NC" AND -license:"CC-BY-ND 4.0 (Int)" to be passed into PrecedenceQueryParser.parse like this:
Query query = new PrecedenceQueryParser().parse(filter, '')
But in the generated query you can see, clauses are like -lincense:CC-BY-NC, "" are lost.
Is there any settings to keep the ""?
===================== UPDATE ===========================
I understand that since I'm looking for a match of CC-BY-ND 4.0 (Int), without double quotes (double quotes are just used to make it a phrase). That's why query.clauses[1].query doesn't have "" around the CC-BY-ND 4.0 (Int)
Now I do this:
def bqb = new BooleanQuery.Builder()
clauses.each { clause ->
bqb.add(clause.query, clause.prohibited ? BooleanClause.Occur.SHOULD : BooleanClause.Occur.MUST_NOT)
}
String s = bqb.build().toString()
build a BooleanQuery and put clauses together,
the s then equals to license:CC-BY-ND 4.0 (Int) license:CC-BY-NC
This is definitely not what I want, I need CC-BY-ND 4.0 (Int) to be surrounded by double-quotes. Is there any way to do that?
Gibbs's could be a solution but a bit tricky I think.
