Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63053D354 for ; Fri, 5 Oct 2012 15:22:06 +0000 (UTC) Received: (qmail 53777 invoked by uid 500); 5 Oct 2012 15:22:04 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 53564 invoked by uid 500); 5 Oct 2012 15:22:04 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 53447 invoked by uid 99); 5 Oct 2012 15:22:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2012 15:22:04 +0000 Date: Fri, 5 Oct 2012 15:22:04 +0000 (UTC) From: "Rodrigo Vega (JIRA)" To: dev@lucene.apache.org Message-ID: <329894505.1244.1349450524241.JavaMail.jiratomcat@arcas> Subject: [jira] [Created] (LUCENE-4461) Multiple FacetRequest with the same path creates inconsistent results MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Rodrigo Vega created LUCENE-4461: ------------------------------------ Summary: Multiple FacetRequest with the same path creates inconsistent results Key: LUCENE-4461 URL: https://issues.apache.org/jira/browse/LUCENE-4461 Project: Lucene - Core Issue Type: Bug Components: modules/facet Affects Versions: 3.6 Reporter: Rodrigo Vega Multiple FacetRequest are getting merged into one creating wrong results in this case: FacetSearchParams facetSearchParams = new FacetSearchParams(); facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"), 10)); facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"), 10)); Problem can be fixed defining hashcode and equals in certain way that Lucene recognize we are talking about different requests. A Very simple test case: ======================== public class LuceneFacetTest { @Test public void testDuplicateFacetRequest() throws Exception { IndexWriter writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(Version.LUCENE_36, new StandardAnalyzer(Version.LUCENE_36))); Directory taxoDir = new RAMDirectory(); TaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir, OpenMode.CREATE); Document doc = new Document(); doc.add(new Field("title", "simple text title", Store.YES, org.apache.lucene.document.Field.Index.ANALYZED)); List categories = new ArrayList(); categories.add(new CategoryPath("author", "Mark Twain")); categories.add(new CategoryPath("year", "2010")); CategoryDocumentBuilder categoryDocBuilder = new CategoryDocumentBuilder(taxoWriter); categoryDocBuilder.setCategoryPaths(categories); categoryDocBuilder.build(doc); writer.addDocument(doc); writer.commit(); taxoWriter.commit(); IndexReader indexReader = IndexReader.open(writer, true); IndexSearcher searcher = new IndexSearcher(indexReader); TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir); Query q = new TermQuery(new Term("title", "text")); TopScoreDocCollector tdc = TopScoreDocCollector.create(10, true); FacetSearchParams facetSearchParams = new FacetSearchParams(); facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"), 10)); facetSearchParams.addFacetRequest(new CountFacetRequest(new CategoryPath("author"), 10)); FacetsCollector facetsCollector = new FacetsCollector(facetSearchParams, indexReader, taxoReader); searcher.search(q, MultiCollector.wrap(tdc, facetsCollector)); List res = facetsCollector.getFacetResults(); Assert.assertEquals("Only Mark Twain should be returned as result", 1, res.get(0).getNumValidDescendants()); Assert.assertEquals("Only Mark Twain should be returned as result", 1, res.get(1).getNumValidDescendants()); } } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org