Make check of BooleanClause.Occur[] in MultiFieldQueryParser.parse less stubborn
--------------------------------------------------------------------------------

                 Key: LUCENE-2518
                 URL: https://issues.apache.org/jira/browse/LUCENE-2518
             Project: Lucene - Java
          Issue Type: Improvement
          Components: QueryParser
    Affects Versions: 3.0.2, 3.0.1, 3.0, 2.9.3, 2.9.2, 2.9.1, 2.9
            Reporter: Itamar Syn-Hershko
            Priority: Minor


Update the check in:

  public static Query parse(Version matchVersion, String query, String[] fields,
      BooleanClause.Occur[] flags, Analyzer analyzer) throws ParseException {
    if (fields.length != flags.length)
      throw new IllegalArgumentException("fields.length != flags.length");

To be:
    if (fields.length > flags.length)

So the consumer can use one Occur array and apply fields selectively. The only 
danger here is with hitting a non-existent cell in flags, and this check will 
provide this just as well without limiting usability for such cases.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to