Buggy code:
public class TestMultiFieldQueryParser extends TestCase { public void testSimple ( ) throws Exception { String [ ] fields = new String [ ] { "b" , "t" } ; MultiFieldQueryParser mfqp = new MultiFieldQueryParser ( fields , new StandardAnalyzer ( ) ) ; Query q = mfqp . parse ( "one" ) ; assertEquals ( "b:one<seq2seq4repair_space>t:one" , q . toString ( ) ) ; q = mfqp . parse ( "one<seq2seq4repair_space>two" ) ; assertEquals ( "(b:one<seq2seq4repair_space>t:one)<seq2seq4repair_space>(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; q = mfqp . parse ( "+one<seq2seq4repair_space>+two" ) ; assertEquals ( "+(b:one<seq2seq4repair_space>t:one)<seq2seq4repair_space>+(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; <START_BUG> q = mfqp . parse ( "+one<seq2seq4repair_space>-two<seq2seq4repair_space>-three)" ) ; <END_BUG> assertEquals ( "+(b:one<seq2seq4repair_space>t:one)<seq2seq4repair_space>-(b:two<seq2seq4repair_space>t:two)<seq2seq4repair_space>-(b:three<seq2seq4repair_space>t:three)" , q . toString ( ) ) ; q = mfqp . parse ( "one^2<seq2seq4repair_space>two" ) ; assertEquals ( "((b:one<seq2seq4repair_space>t:one)^2.0)<seq2seq4repair_space>(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; q = mfqp . parse ( "one~<seq2seq4repair_space>two" ) ; assertEquals ( "(b:one~0.5<seq2seq4repair_space>t:one~0.5)<seq2seq4repair_space>(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; q = mfqp . parse ( "one~0.8<seq2seq4repair_space>two^2" ) ; assertEquals ( "(b:one~0.8<seq2seq4repair_space>t:one~0.8)<seq2seq4repair_space>((b:two<seq2seq4repair_space>t:two)^2.0)" , q . toString ( ) ) ; q = mfqp . parse ( "one*<seq2seq4repair_space>two*" ) ; assertEquals ( "(b:one*<seq2seq4repair_space>t:one*)<seq2seq4repair_space>(b:two*<seq2seq4repair_space>t:two*)" , q . toString ( ) ) ; q = mfqp . parse ( "[a<seq2seq4repair_space>TO<seq2seq4repair_space>c]<seq2seq4repair_space>two" ) ; assertEquals ( "(b:[a<seq2seq4repair_space>TO<seq2seq4repair_space>c]<seq2seq4repair_space>t:[a<seq2seq4repair_space>TO<seq2seq4repair_space>c])<seq2seq4repair_space>(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; q = mfqp . parse ( "w?ldcard" ) ; assertEquals ( "b:w?ldcard<seq2seq4repair_space>t:w?ldcard" , q . toString ( ) ) ; q = mfqp . parse ( "\"foo<seq2seq4repair_space>bar\"" ) ; assertEquals ( "b:\"foo<seq2seq4repair_space>bar\"<seq2seq4repair_space>t:\"foo<seq2seq4repair_space>bar\"" , q . toString ( ) ) ; q = mfqp . parse ( "\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\"<seq2seq4repair_space>\"dd<seq2seq4repair_space>ee\"" ) ; assertEquals ( "(b:\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\"<seq2seq4repair_space>t:\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\")<seq2seq4repair_space>(b:\"dd<seq2seq4repair_space>ee\"<seq2seq4repair_space>t:\"dd<seq2seq4repair_space>ee\")" , q . toString ( ) ) ; q = mfqp . parse ( "\"foo<seq2seq4repair_space>bar\"~4" ) ; assertEquals ( "b:\"foo<seq2seq4repair_space>bar\"~4<seq2seq4repair_space>t:\"foo<seq2seq4repair_space>bar\"~4" , q . toString ( ) ) ; q = mfqp . parse ( "one<seq2seq4repair_space>f:two" ) ; assertEquals ( "(b:one<seq2seq4repair_space>t:one)<seq2seq4repair_space>f:two" , q . toString ( ) ) ; mfqp . setDefaultOperator ( AND_OPERATOR ) ; q = mfqp . parse ( "one<seq2seq4repair_space>two" ) ; assertEquals ( "+(b:one<seq2seq4repair_space>t:one)<seq2seq4repair_space>+(b:two<seq2seq4repair_space>t:two)" , q . toString ( ) ) ; q = mfqp . parse ( "\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\"<seq2seq4repair_space>\"dd<seq2seq4repair_space>ee\"" ) ; assertEquals ( "+(b:\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\"<seq2seq4repair_space>t:\"aa<seq2seq4repair_space>bb<seq2seq4repair_space>cc\")<seq2seq4repair_space>+(b:\"dd<seq2seq4repair_space>ee\"<seq2seq4repair_space>t:\"dd<seq2seq4repair_space>ee\")" , q . toString ( ) ) ; } public void testBoostsSimple ( ) throws Exception { } public void testStaticMethod1 ( ) throws ParseException { } public void testStaticMethod2 ( ) throws ParseException { } public void testStaticMethod2Old ( ) throws ParseException { } public void testStaticMethod3 ( ) throws ParseException { } public void testStaticMethod3Old ( ) throws ParseException { } public void testAnalyzerReturningNull ( ) throws ParseException { } public void testStopWordSearching ( ) throws Exception { } private static class AnalyzerReturningNull extends Analyzer { StandardAnalyzer stdAnalyzer = new StandardAnalyzer ( ) ; public AnalyzerReturningNull ( ) { } public TokenStream tokenStream ( String fieldName , Reader reader ) { } private static class EmptyTokenStream extends TokenStream { public Token next ( ) { } } } }

Fix:
q = mfqp . parse ( "+one<seq2seq4repair_space>-two<seq2seq4repair_space>-three" ) ;