query parser - Lucene QueryParser: must contain either one or the other among other MUST clauses -


how can queryparser apache lucene used have query either contains term or term b (or both, @ least 1 of them). edit: also, contains other must clauses, e.g., must contain c , must contain either or b.

is correct?

+(a or b) +c 

it simply: a or b (or a b)

this generate 2 booleanclauses occur.should. in case, @ least 1 clause has match whole booleanquery match:

/** use operator clauses <i>should</i> appear in   * matching documents. booleanquery no <code>must</code>   * clauses 1 or more <code>should</code> clauses must match document   * booleanquery match.  * @see booleanquery#setminimumnumbershouldmatch  */ should   { @override public string tostring() { return "";  } }, 

answer updated question:

(a or b) , c should want.

i'm not sure +(a or b) +c since looks should work stated +(a or b) doesn't work expect in original question.

to make sure, can take @ queryparser generates. you'd need kind of query structure:

  • booleanquery
    • must: booleanquery
      • should: termquery: a
      • should: termquery: b
    • must: termquery: c

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -