jpountz commented on a change in pull request #1541: URL: https://github.com/apache/lucene-solr/pull/1541#discussion_r450944716
########## File path: lucene/core/src/java/org/apache/lucene/search/RegexpQuery.java ########## @@ -96,16 +96,46 @@ public RegexpQuery(Term term, int flags, int maxDeterminizedStates) { * Constructs a query for terms matching <code>term</code>. * * @param term regular expression. - * @param flags optional RegExp features from {@link RegExp} + * @param maxDeterminizedStates maximum number of states that compiling the + * @param syntax_flags optional RegExp syntax features from {@link RegExp} + * automaton for the regexp can result in. Set higher to allow more complex + * queries and lower to prevent memory exhaustion. + * @param match_flags boolean 'or' of match behavior options such as case insensitivity + */ + public RegexpQuery(Term term, int maxDeterminizedStates, int syntax_flags, int match_flags) { + this(term, defaultProvider, maxDeterminizedStates, syntax_flags, match_flags); + } + + /** + * Constructs a query for terms matching <code>term</code>. + * + * @param term regular expression. + * @param syntax_flags optional RegExp features from {@link RegExp} * @param provider custom AutomatonProvider for named automata * @param maxDeterminizedStates maximum number of states that compiling the * automaton for the regexp can result in. Set higher to allow more complex * queries and lower to prevent memory exhaustion. */ - public RegexpQuery(Term term, int flags, AutomatonProvider provider, + public RegexpQuery(Term term, int syntax_flags, AutomatonProvider provider, int maxDeterminizedStates) { + this(term, provider, maxDeterminizedStates, syntax_flags, 0); + } + + /** + * Constructs a query for terms matching <code>term</code>. + * + * @param term regular expression. + * @param syntax_flags optional RegExp features from {@link RegExp} + * @param provider custom AutomatonProvider for named automata + * @param maxDeterminizedStates maximum number of states that compiling the + * automaton for the regexp can result in. Set higher to allow more complex + * queries and lower to prevent memory exhaustion. + * @param match_flags boolean 'or' of match behavior options such as case insensitivity + */ + public RegexpQuery(Term term, AutomatonProvider provider, + int maxDeterminizedStates, int syntax_flags, int match_flags) { Review comment: In my opinion, all constructors should always take parameters in the same order. The current longest constructor does `RegexpQuery(Term term, int syntaxFlags, AutomatonProvider provider, int maxDeterminizedStates)`, so I think that this one should be `RegexpQuery(Term term, int syntaxFlags, int matchFlags, AutomatonProvider provider, int maxDeterminizedStates)`. ########## File path: lucene/core/src/java/org/apache/lucene/util/automaton/RegExp.java ########## @@ -499,10 +508,29 @@ public RegExp(String s) throws IllegalArgumentException { * regular expression */ public RegExp(String s, int syntax_flags) throws IllegalArgumentException { + this(s, syntax_flags, 0); + } + /** + * Constructs new <code>RegExp</code> from a string. + * + * @param s regexp string + * @param syntax_flags boolean 'or' of optional syntax constructs to be + * enabled + * @param match_flags boolean 'or' of match behavior options such as case insensitivity + * @exception IllegalArgumentException if an error occurred while parsing the + * regular expression + */ + public RegExp(String s, int syntax_flags, int match_flags) throws IllegalArgumentException { + // (for BWC reasons we don't validate invalid bits, just trim instead) + syntax_flags = syntax_flags & 0xff; Review comment: I don't think we need to maintain bw compat for this, is there any test that fails if you remove this line? ########## File path: lucene/core/src/java/org/apache/lucene/search/RegexpQuery.java ########## @@ -96,16 +96,46 @@ public RegexpQuery(Term term, int flags, int maxDeterminizedStates) { * Constructs a query for terms matching <code>term</code>. * * @param term regular expression. - * @param flags optional RegExp features from {@link RegExp} + * @param maxDeterminizedStates maximum number of states that compiling the + * @param syntax_flags optional RegExp syntax features from {@link RegExp} + * automaton for the regexp can result in. Set higher to allow more complex + * queries and lower to prevent memory exhaustion. + * @param match_flags boolean 'or' of match behavior options such as case insensitivity + */ + public RegexpQuery(Term term, int maxDeterminizedStates, int syntax_flags, int match_flags) { Review comment: I'd keep maxDeterminizedStates last so that all constructors take parameters in the same order. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org