Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 15966 invoked from network); 26 Feb 2009 18:45:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2009 18:45:50 -0000 Received: (qmail 63301 invoked by uid 500); 26 Feb 2009 18:45:43 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 63277 invoked by uid 500); 26 Feb 2009 18:45:43 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 63266 invoked by uid 99); 26 Feb 2009 18:45:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Feb 2009 10:45:42 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Feb 2009 18:45:35 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1LclEQ-0001K6-UW for java-user@lucene.apache.org; Thu, 26 Feb 2009 10:45:14 -0800 Message-ID: <22230841.post@talk.nabble.com> Date: Thu, 26 Feb 2009 10:45:14 -0800 (PST) From: Chetan Shah To: java-user@lucene.apache.org Subject: TermsFilter Usage Question MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: chetankrshah@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Why is this code not returning any results? //Create the query and search QueryParser queryParser = new QueryParser("contents", new StandardAnalyzer()); Query query = queryParser.parse(searchCriteria); Term aTerm = new Term("categoryType"); TermsFilter categoryFilter = new TermsFilter(); aTerm = aTerm.createTerm("xyz"); categoryFilter.addTerm(aTerm); TopDocs topDocs = indexSearcher.search(query, categoryFilter, Constants.MAX_HITS); /** 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 = indexSearcher.search(query, 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: http://www.nabble.com/TermsFilter-Usage-Question-tp22230841p22230841.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org