Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3F2BC1035E for ; Mon, 23 Jun 2014 13:31:49 +0000 (UTC) Received: (qmail 28062 invoked by uid 500); 23 Jun 2014 13:31:47 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 28003 invoked by uid 500); 23 Jun 2014 13:31:47 -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 27991 invoked by uid 99); 23 Jun 2014 13:31:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jun 2014 13:31:46 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of serera@gmail.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-wg0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jun 2014 13:31:44 +0000 Received: by mail-wg0-f43.google.com with SMTP id b13so6268887wgh.2 for ; Mon, 23 Jun 2014 06:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=26SxRmBHogl5+AoFffQfiAYr4k71GGIH92Ggim8AdAg=; b=CkDS+oO0zDoZdxcSf585//ixiTs2zKL6+LRvbYM40OJC5ny6Uiis4tGmLlqb6t7iJJ xnWnPMNQEiqKVNhMYc6OVTM+HAAL2X/xDd266DbsZRD06qZlf22x4WHgEIxDUoHw2/us mpfZ7f8ve7H17ZJolk+5pKuDNDAcJ5pDKOvqTKwExzhxqVyXg1KC0TtebqNkoQGg4LtZ LrfwF8FdumJ3sllDjumLuUHHjJKQjuvXtGZ3Yj3pUstv+aaQdHEtGQRlocK8MWnoeKF5 8l7EPhV11jXE9okGAYGS6xV08leaxJ+G5aMaIRYe3eaptUBR8TvsRvhOLwVipoFD4erc GASg== X-Received: by 10.194.110.161 with SMTP id ib1mr3632404wjb.129.1403530275678; Mon, 23 Jun 2014 06:31:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.8.97 with HTTP; Mon, 23 Jun 2014 06:30:55 -0700 (PDT) In-Reply-To: References: From: Shai Erera Date: Mon, 23 Jun 2014 16:30:55 +0300 Message-ID: Subject: Re: Lucene Facets Module 4.8.1 To: "java-user@lucene.apache.org" Content-Type: multipart/alternative; boundary=089e0102fc528372a104fc80dbd0 X-Virus-Checked: Checked by ClamAV on apache.org --089e0102fc528372a104fc80dbd0 Content-Type: text/plain; charset=UTF-8 Basically, it's not very common to change the indexFieldName. You should do that in case you e.g. count facets in groups of dimensions, rather than counting all of them. So for example, if you have 20 dimensions, but you know you only count d1-d5, d6-d12 and d13-d20, then if you separate them to 3 different indexFieldNames will probably improve performance. But if you can't make such a decision, it's better to not modify this. When you initialize a FacetCounts, it counts all the dimensions that are indexed under that indexFieldName, so if you need the counts of all of them, or the majority of them, that's ok. But if you know you *always* need the count of a subset of them, then separating that subset to a different field is better. Hope that clarifies. Shai On Mon, Jun 23, 2014 at 4:18 PM, Jigar Shah wrote: > Thanks this worked for me :) > > Is there any advantage of indexing some facets as not providing any > indexFieldName ? > > Thanks > > > > > On Mon, Jun 23, 2014 at 12:55 PM, Shai Erera wrote: > > > There is no sample code for doing that but it's quite straightforward - > if > > you know you indexed some dimensions under different indexFieldNames, > > initialize a FacetCounts per such field name, e.g.: > > > > FastTaxoFacetCounts defaultCounts = new FastTaxoFacetCounts(...); // for > > your regular facets > > FastTaxoFacetCounts cityCounts = new FastTaxoFacetCounts(...); // for > your > > CITY facets > > > > Something like that... > > > > Shai > > > > > > On Mon, Jun 23, 2014 at 9:04 AM, Jigar Shah > wrote: > > > > > On commenting > > > > > > //config.setIndexFieldName("CITY", "city"); at search time, this is > > before > > > i do, getTopChildren(...) > > > > > > I get following exception. > > > > > > Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 > > > at > > > > > > > > > org.apache.lucene.facet.taxonomy.FastTaxonomyFacetCounts.count(FastTaxonomyFacetCounts.java:74) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > at > > > > > > > > > org.apache.lucene.facet.taxonomy.FastTaxonomyFacetCounts.(FastTaxonomyFacetCounts.java:49) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > at > > > > > > > > > org.apache.lucene.facet.taxonomy.FastTaxonomyFacetCounts.(FastTaxonomyFacetCounts.java:39) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > at > > > > > > > > > org.apache.lucene.facet.DrillSideways.buildFacetsResult(DrillSideways.java:110) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > at > > org.apache.lucene.facet.DrillSideways.search(DrillSideways.java:177) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > at > > org.apache.lucene.facet.DrillSideways.search(DrillSideways.java:203) > > > [lucene-facet-4.8.1.jar:4.8.1 1594670 - rmuir - 2014-05-14 19:23:23] > > > > > > Application level excepitons..... > > > ... > > > ... > > > > > > > > > > > > On Sat, Jun 21, 2014 at 10:56 PM, Michael McCandless < > > > lucene@mikemccandless.com> wrote: > > > > > > > Are you sure it's the same FacetsConfig at search time? Because the > > > > exception implies your CITY field didn't have > > > > config.setIndexFieldName("CITY", "city") called. > > > > > > > > Or, can you try commenting out 'config.setIndexFieldName("CITY", > > > > "city")' at index time and see if the exception still happens? > > > > > > > > Mike McCandless > > > > > > > > http://blog.mikemccandless.com > > > > > > > > > > > > On Sat, Jun 21, 2014 at 1:08 AM, Jigar Shah > > > wrote: > > > > > Thanks for helping me. > > > > > > > > > > Yes, i did couple of things: > > > > > > > > > > Below is simple code for indexing which i use. > > > > > > > > > > TrackingIndexWriter nrtWriter > > > > > DirectoryTaxonomyWriter taxoWriter = ... > > > > > .... > > > > > FacetsConfig config = new FacetConfig(); > > > > > config.setHierarchical("CITY", true) > > > > > config.setMultiValued("CITY", true); > > > > > config.setIndexFieldName("CITY","city") // I kept dimName different > > > from > > > > > indexFieldName > > > > > .... > > > > > Added indexing searchable fields... > > > > > .... > > > > > > > > > > doc.add( new FacetField("CITY", "India", "Gujarat", "Vadodara" )) > > > > > doc.add( new FacetField("CITY", "India", "Gujarat", "Ahmedabad" )) > > > > > > > > > > nrtWriter.addDocument(config.build(taxoWriter, doc)); > > > > > > > > > > Below is code which i use for searching > > > > > > > > > > TaxonomyReader taxoReader = new > DirectoryTaxonomyReader(taxoWriter); > > > > > > > > > > Query query = ... > > > > > IndexSearcher searcher = ... > > > > > DrillDownQuery ddq = new DrillDownQuery(config, query); > > > > > DrillSideways ds = new DrillSideways(searcher, config, taxoReader); > > // > > > > > Config object is same which i created before > > > > > DrillSidewaysResult result = ds.search(query, null, null, start + > > > limit, > > > > > null, true, true) > > > > > ... > > > > > Facets f = result.facets > > > > > FacetResult fr = f.getTopChildren(5, "CITY") [Exception is > > geneated]// > > > > > Didn't perform any drill-down,really, its just original query for > > first > > > > > time, but wrapped in DrillDownQuery. > > > > > > > > > > ... and below gives me empty collection. > > > > > > > > > > List frs= f.getAllDims(5) > > > > > > > > > > I debug source code and found, it internally calls > > > > > > > > > > FastTaxonomyFacetCounts(indexFieldName, taxoReader, config) // > Config > > > > > object is same which i created before > > > > > > > > > > which then calls > > > > > > > > > > IntTaxonomyFacets(indexFieldName, taxoReader, config) // Config > > object > > > is > > > > > same which i created before > > > > > > > > > > And during this calls the value of indexFieldName is "$facets > defined > > > by > > > > > constant 'public static final String DEFAULT_INDEX_FIELD_NAME = > > > > "$facets";' > > > > > in FacetsConfig. > > > > > > > > > > My question is if i am using same FacetsConfig while indexing and > > > > > searching. why its not identifying correct name of field, and goes > > for > > > > > "$facets" > > > > > > > > > > Please correct me if i understood wrong. or correct way to solve > > above > > > > > problem. > > > > > > > > > > Many Thanks. > > > > > Jigar Shah. > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > > > > For additional commands, e-mail: java-user-help@lucene.apache.org > > > > > > > > > > > > > > --089e0102fc528372a104fc80dbd0--