Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0A6A1200CFA for ; Tue, 5 Sep 2017 23:20:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 028331609ED; Tue, 5 Sep 2017 21:20:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 21F941609EA for ; Tue, 5 Sep 2017 23:20:47 +0200 (CEST) Received: (qmail 85883 invoked by uid 500); 5 Sep 2017 21:20:46 -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 85871 invoked by uid 99); 5 Sep 2017 21:20:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2017 21:20:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 489F9D4EA7 for ; Tue, 5 Sep 2017 21:20:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.781 X-Spam-Level: * X-Spam-Status: No, score=1.781 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=mikemccandless-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id YUjGr44YCs9S for ; Tue, 5 Sep 2017 21:20:40 +0000 (UTC) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A3C6260EE9 for ; Tue, 5 Sep 2017 21:20:38 +0000 (UTC) Received: by mail-it0-f53.google.com with SMTP id p6so5251331itb.1 for ; Tue, 05 Sep 2017 14:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mikemccandless-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=C3Wqf2Z6HrYjVF2QQ3Vx04+XMXn8zvDTgu1XsUdfy+I=; b=QRe2CCVsefk829lXfNqbtSvYI0Zt7qE4naTq8BL4uaumzunPxV+D5dOmlKGoOSt9Km ut9H6WpISS4TpqF6eeo+wO1Dk5QQ8nqSpThfcLNgtCdx+1ZFiUAjPYRLeNVJfOw1Ol1t y1e+hGhbmIYJvxq7lcbH+dIzEKivwL2kWd486z+1Q0szIFuYFfOWkLyhuwbkC6gzM5we fuPxi4voOFDDxRlObCXk5y8xSOyeXDerPtEc88sVXh5ZQ1R9ZDPCojtehWpxz7/Yler9 ynBp0Tx3y79PvYniY8d+/Ty2Jzt8KL+9QKZRSPt2Z3VJwJSsifBvNIB4mKhhXq1BwueK +9Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=C3Wqf2Z6HrYjVF2QQ3Vx04+XMXn8zvDTgu1XsUdfy+I=; b=KfCdLOR52Px4aX8HdZx50MoV+ziNHZhn16Las2n0t6jQfx1tN/NXR6jUZ3SFe0u/a3 M2n1acd4SjV7sw3O2kBDg7FMoUw7ZP3gLymXNq0Qj7NhJXHczrinqct8NveVZOwdyNtF WbwbhMG7Et7gogfsK7leUOhAJqjzprQOGLjZWFtNuI2/5lgcuCO9qyHZM4/4NS0Gop6i nldHdfT/d/pHkjyyd04PIQDbVsUNPCnebI/T5Ldx3LabRr5NruSFKsAiUilJnjuEktWt 3DC9rOOgQped3a9EZRovXjJrK3EI93yLGRejafjDxR4RdJhuF0C0DdT+kbwTzKvBNZWf 4KXw== X-Gm-Message-State: AHPjjUiPg/Q6QfeLj9a29KGtn5L5ZVf3Xxs439CjXSYv2hV2VSmX6d2F LcsU45P+10FVQUxYniwxdPfU9iT2FgMX X-Google-Smtp-Source: ADKCNb6U16SYjKFvNZ19LFzJSLUDGUaPEHkg/eqlghIWaCGVjHZs/fF5qjmShJGmuwKi880KCd35zAjuwFvMuc5GqdE= X-Received: by 10.36.198.197 with SMTP id j188mr559025itg.169.1504646437309; Tue, 05 Sep 2017 14:20:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.33.9 with HTTP; Tue, 5 Sep 2017 14:19:56 -0700 (PDT) In-Reply-To: References: From: Michael McCandless Date: Tue, 5 Sep 2017 17:19:56 -0400 Message-ID: Subject: Re: How to load all document fields, together with facet fields? To: Vjeran Marcinko Cc: Lucene Users Content-Type: multipart/alternative; boundary="94eb2c07d10468b293055877cc33" archived-at: Tue, 05 Sep 2017 21:20:49 -0000 --94eb2c07d10468b293055877cc33 Content-Type: text/plain; charset="UTF-8" You'll just have to add additional StoredField instances for all those facet fields as well. The FacetField is consumed as an inverted field and not directly stored, though you could do some work and reconstruct it from the binary doc values that the facet store. Mike McCandless http://blog.mikemccandless.com On Sat, Sep 2, 2017 at 10:08 AM, Vjeran Marcinko wrote: > Yes, when I load the doc plainly using IndexSearcher, I got the doc, > but without special faceted fields:: > > name = firstDoc (stored,indexed,tokenized,omitNorms,indexOptions=DOCS) > category = cars (stored,indexed,tokenized) > > But I need all those faceted fields somehow, such as when I was saving > the doc first time: > > facet_category = null (docValuesType=SORTED_SET) > facet_category = category cars (indexed,omitNorms,indexOptions=DOCS) > facet_category = category (indexed,omitNorms,indexOptions=DOCS) > name = firstDoc (stored,indexed,omitNorms,indexOptions=DOCS) > category = cars (stored,indexed,tokenized) > > So I'm spekaing how to get those "facet_category" fields, not > "category"... And I need those because when I update the docs, faceted > search/coutnting doesn't work without those... > > -Vjeran > > > On Sat, Sep 2, 2017 at 11:44 AM, Michael McCandless > wrote: > > Right, you just need another line like this: > > > > doc.add(new StoredField("storedcategory", category)); > > > > Though, since your TextField category is marked as Field.Store.YES, it > > should have been in the document when you loaded it at search time. Are > you > > sure it's not there? > > > > Mike McCandless > > > > http://blog.mikemccandless.com > > > > On Fri, Sep 1, 2017 at 11:44 AM, Vjeran Marcinko > > wrote: > >> > >> Hmmm, dunno what you mean... I currently store my simple document like > >> this: > >> > >> doc.add(new StringField("name", name, Field.Store.YES)); > >> doc.add(new TextField("category", category, Field.Store.YES)); > >> doc.add(new SortedSetDocValuesFacetField("category", category)); > >> Document finalDoc = facetConfig.build(doc); > >> > >> So you see, "category" is faceted field. And as I said, I can do > >> faceted search due to this SortedSetDocValuesFacetField, but problem > >> is when I load the document and then update it in index, then this > >> faceted fields dissapear, because they were not loaded in plain way. > >> > >> -Vjeran > >> > >> On Fri, Sep 1, 2017 at 3:02 PM, Michael McCandless > >> wrote: > >> > You should separately add those fields to your document, using > >> > StoredField, > >> > if you want to retrieve their values at search time. > >> > > >> > Mike McCandless > >> > > >> > http://blog.mikemccandless.com > >> > > >> > On Thu, Aug 31, 2017 at 1:29 PM, Vjeran Marcinko > > >> > wrote: > >> >> > >> >> I zeroed in the problem with my updating documents having facet > >> >> fields... What I need is a way to load document with all fields that > >> >> existing when I was saving the document, meaning, together with facet > >> >> fields. > >> >> > >> >> Anyway, here's the example. > >> >> > >> >> When I add my document to index, my document is having 3 fields: > >> >> "name", "category" and 3rd field is SortedSetDocValueFacetField named > >> >> also "category". This is the list of fields printed: > >> >> > >> >> name = firstDoc (stored,indexed,omitNorms,indexOptions=DOCS) > >> >> category = cars (stored,indexed,tokenized) > >> >> dummy = null (indexed,tokenized) > >> >> > >> >> And before adding to index I build the final document via > >> >> facetConfig.build(doc) which produces following fields: > >> >> > >> >> facet_category = null (docValuesType=SORTED_SET) > >> >> facet_category = category cars (indexed,omitNorms,indexOptions=DOCS) > >> >> facet_category = category (indexed,omitNorms,indexOptions=DOCS) > >> >> name = firstDoc (stored,indexed,omitNorms,indexOptions=DOCS) > >> >> category = cars (stored,indexed,tokenized) > >> >> > >> >> But, when I load the document plainly using IndexSearcher, I get > >> >> following: > >> >> > >> >> name = firstDoc (stored,indexed,tokenized, > omitNorms,indexOptions=DOCS) > >> >> category = cars (stored,indexed,tokenized) > >> >> > >> >> Which is not good if I want to update the document, because there are > >> >> no facet fields anymore here, so when I update it, these fields get > >> >> lost, so my faceted searching afterwards don't work :( > >> >> > >> >> Any suggestion? > >> >> > >> >> -Vjeran > >> >> > >> >> ------------------------------------------------------------ > --------- > >> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >> >> For additional commands, e-mail: java-user-help@lucene.apache.org > >> >> > >> > > > > > > --94eb2c07d10468b293055877cc33--