aspose file tools*
The moose likes Other Open Source Projects and the fly likes Lucene Query.toString returns blank/empty value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Lucene Query.toString returns blank/empty value" Watch "Lucene Query.toString returns blank/empty value" New topic
Author

Lucene Query.toString returns blank/empty value

Ajay Singh
Ranch Hand

Joined: Jan 04, 2008
Posts: 105
Hi,
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 "Considering.think.Considering.Cognizer.community.Considering.aux.would" 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:-
"Considering.think.Considering.Cognizer.community.Considering.aux.would"

Pattern Number 2:-
"Prohibiting.deny.Prohibiting.StateUNDRofUNDRaffairs.access.Prohibiting.StateUNDRofUNDRaffairs.Descriptor.church.Prohibiting.Explanation.premise.Prohibiting.Explanation.Descriptor.school.Prohibiting.Explanation.view.Prohibiting.Explanation.Characteristic.film.Prohibiting.Explanation.KindUNDRof.public"

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Lucene Query.toString returns blank/empty value
 
Similar Threads
Special Characters Lucene
0 hits while using pharsequery
Lucene beginner question
Lucene +PhraseQuery
Lucene - get TermVector positions