lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chetan Shah <>
Subject TermsFilter Usage Question
Date Thu, 26 Feb 2009 18:45:14 GMT

Why is this code not returning any results?

            //Create the query and search
            QueryParser queryParser = new QueryParser("contents", new
            Query query = queryParser.parse(searchCriteria);
            Term aTerm = new Term("categoryType");
            TermsFilter categoryFilter = new TermsFilter();      
            aTerm = aTerm.createTerm("xyz");
            TopDocs topDocs =, categoryFilter,
            /** above line works if I null the filter **/

            ScoreDoc scoreDoc[] = topDocs.scoreDocs;
            int numDocs = scoreDoc.length;
            if (numDocs > 0) results = scoreDoc;   

If I do this for the line /**works...*// I get valid results.
TopDocs topDocs =, null, Constants.MAX_HITS);

The field "categoryType" is stored in the index. and I have confirmed via
Luke that "xyz" value is stored in the "categoryType" field.

Would highly appreciate if you can let me know what am I doing wrong here.
View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message