public static ArrayList<String> tokenizeQuery(Analyzer luceneAnalyzer,String query){
  ArrayList<String> result=new ArrayList<String>();
  TokenStream tokenStream=luceneAnalyzer.tokenStream(null,new StringReader(query));
  CharTermAttribute term=tokenStream.addAttribute(CharTermAttribute.class);
  try {
    tokenStream.reset();
    while (tokenStream.incrementToken()) {
      result.add(term.toString());
    }
    tokenStream.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return result;
}

public static ArrayList < String > tokenizeQuery ( Analyzer luceneAnalyzer , String query ) { ArrayList < String > result = new ArrayList < String > ( ) ; TokenStream tokenStream = luceneAnalyzer . tokenStream ( null , new StringReader ( query ) ) ; CharTermAttribute term = tokenStream . addAttribute ( CharTermAttribute . class ) ; try { tokenStream . reset ( ) ; while ( tokenStream . incrementToken ( ) ) { result . add ( term . toString ( ) ) ; } tokenStream . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return result ; }
tokenizes the query string using the given analyser
