h1. Moving to the new Lucene Query Parser Recently, a new query parser framework was added to Lucene, it's more flexible and allows the user to easily change/extend the query parser functionalities. But what if you just want to keep using the regular functionalities, do you need to learn how to use all these new stuffs like text parsing, query processing and query building? What if you want just to do parse("a AND b") and get the query object for that? To make your life easier, we included in this new framework a class that helps you to easily switch over to the new query parser, this class is called LuceneQueryParserHelper. This tutorial will demonstrate how to keep using the old query parser functionalities on the new one. It will be done by showing pieces of code that will help you to quickly understand the new way to use the query parser. h2. Simply Parsing a Query String Old way: {code} QueryParser qp = new QueryParser("defaultField", new SimpleAnalyzer()); Query query = qp.parse("a AND b"); {code} New way: {code} LuceneQueryParserHelper qp = new LuceneQueryParserHelper(new SimpleAnalyzer()); Query query = qp.parse("a AND b", "defaultField"); {code} As you can see, it's pretty much the same, the only differece is that you specify the default field when you call "parse" instead of when you construct it. h2. Configuring the Query Parser All the configuration options you had on the old query parser are also available on the new one, the difference is that you need to get a LuceneQueryConfigHandler and set the new configuration on it. Old way: {code} QueryParser qp = new QueryParser("defaultField", new SimpleAnalyzer()); // configuration qp.setAllowLeadingWildcard(true); qp.setDefaultOperator(QueryParser.AND_OPERATOR); // parsing Query query = qp.parse("a AND b"); {code} New way: {code} LuceneQueryParserHelper qp = new LuceneQueryParserHelper(new SimpleAnalyzer()); // configuration LuceneQueryConfigHandler config = qp.getQueryConfigHandler(); config.setAllowLeadingWildcard(true); config.setDefaultOperator(LuceneQueryConfigHandler.Operator.AND); // parsing Query query = qp.parse("a AND b", "defaultField"); {code}