Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Lucene Query.toString returns blank/empty value  RSS feed

Ajay Singh
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to use Lucene for indexing and searching long terms.My terms are of the form A.B.C.D in my documents(Example "" is a term which is indexed).I am able to index terms of such patterns.But retrieving does not work for some of these patterns.I am using StandardAnalyzer while indexing the documents and using the same Analyzer for retrieving.While debugging i found that query.toString is blank(empty) for the patterns which are not being searched.Otherwise some values comes in the Sysout in line number 3 below of my term search logic.

QueryParser queryParser = new QueryParser(Version.LUCENE_30,"TM", standardAnalyzer);
Query query= queryParser.parse("\"" + termToBeSearched + "\"");
System.out.println("===================================================Query :: "+query.toString());
System.out.println("=======================Query Class---->"+query.getClass());

Pattern Number 1:-

Pattern Number 2:-

The query.toString has some values for Pattern no 1( and is able to search it) but is empty/blank for Pattern number 2 while searching although indexing happens for both. What am i doing wrong? is there any limit in lucene regarding term length.Even some of the bigger length terms compared to the second pattern is being searched successfully,so i dont think that is the case.Please guide me.

Thanks in advance.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!