From java-user-return-63680-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Fri Apr 13 11:15:27 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 589A8180627 for ; Fri, 13 Apr 2018 11:15:27 +0200 (CEST) Received: (qmail 61462 invoked by uid 500); 13 Apr 2018 09:15:25 -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 61440 invoked by uid 99); 13 Apr 2018 09:15:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2018 09:15:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 866F018070E for ; Fri, 13 Apr 2018 09:15:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KAM_NUMSUBJECT=0.5, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 2Fldbm4wrG_Y for ; Fri, 13 Apr 2018 09:15:23 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D00ED5F24A for ; Fri, 13 Apr 2018 09:15:22 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id r82so2952222wme.0 for ; Fri, 13 Apr 2018 02:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=OH0a+m8LyS+5ro18iOgMUk0HxUxTnQgdZdvGRpS/KO8=; b=AEOl7MpTAVXR2deDfSUShS+OLCWjil+93RR5pYafmj1VGpLfAZbOx58CoT1pYvsyzm pYbwHZa3PaQ+SsazHIYjHGOhdFBNbnl+vFw5nq+aFg9kHKXFu5WsKY4rIh0Jjot0nyaz hEi/X7MLIHN+nrPo21xqDu6Uiqf9CsRX3VPuED/kngE/p6JiaLOoInDcmniQihcjX4Rw Rt5A9n4Q7Ev5WdlYd0fDWr8jFmhlUN7CwLHc/TRKKSAV8nWLsCsM9tTX3mBpjxSxhCek AHsr2BegN6eOiyft00+OIPX7kRg8I7OIfuV/WMQnPambiLcJMHPltA9yBrMu2dY3toxD qJVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=OH0a+m8LyS+5ro18iOgMUk0HxUxTnQgdZdvGRpS/KO8=; b=Y9oDpIIrtmAoSoP6whw75xgkjY1KzfGcem0zKOnqUb2SVzY1txiutoglgY7Y4bt8IA QRT+JZxagAJ7Fv4/4RxqzZTthMnUHqrQbOy0t39hpnnLLtYfrBJT/NwmurL25fp6S+A8 mDqZAsygNBNB6BMdDkeSi7l3RKGbqI9FkoA1zkt4ORdw+7QLVUzVC3SfGpjWPsgIFA6o 1yz+X8bJ/zcI4NaVzd/YMH8aoXG0Q/KV+p7+yr4KsPhl+WdPmg39pNERk5YLXF09AZTa WDfI2ATFV36w240q8TRcRsz/2ZhkJ7H3C5Zy7GRhF+BC/6QGsrwDvmU6Aa3aLYmjK1m6 Gdgw== X-Gm-Message-State: ALQs6tCImiQDlaUdQrXeKHUdgI+Hc53EXv2n7/YwCG16dsOS3bnYB19Y AK0pmPIOBIfLlclrCHc7G34+XIZBJ4MyyWOXZkE= X-Google-Smtp-Source: AIpwx49wZKZpqDHusbEij1bb84URK9rSpxA/eo2zv58+T+Jup7MQEvUWOLkM8ZNJjfSF5lBjwskWNhPPonoGQJl+3VY= X-Received: by 10.28.107.151 with SMTP id a23mr2919735wmi.14.1523610921597; Fri, 13 Apr 2018 02:15:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Adrien Grand Date: Fri, 13 Apr 2018 09:15:11 +0000 Message-ID: Subject: Re: what's replacement of FieldCache in Lucene 7 To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary="001a11477c04c1fdbd0569b74fe5" --001a11477c04c1fdbd0569b74fe5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Performance may be worse with stored fields indeed. In general Lucene makes the assumption that millions of documents are queried but only ~100 documents are retrieved in the end, so the bottleneck should be query processing, not retrieving stored fieds. Le ven. 13 avr. 2018 =C3=A0 05:27, Yonghui Zhao a = =C3=A9crit : > My case is when I get some docs from lucene, I need also get some field > value of the retrieved docs. > > For example in lucene 4, I use FieldCache like this. > > FieldCache.DEFAULT.getTerms(reader, name, > false).get(locDocId).utf8ToString(); > > FieldCache.DEFAULT.getInts(reader, name, false).get(locDocId); > > FieldCache.DEFAULT.getDoubles(reader, name, false).get(locDocId); > > > while docId may be not in ascending order. > > Of course I can use stored field like this > > Document doc =3D indexSearcher.doc(docId, storedFields.keySet()); > > > But the performance should be worse than FieldCache. > > > 2018-04-12 19:57 GMT+08:00 Adrien Grand : > > > Hello, > > > > Doc values should be used instead of the field cache indeed. Note that > this > > require to add them to your documents at index time, eg. with a > > NumericDocValuesField. > > > > Regarding random access, maybe you can use the advanceExact API, which > > exists on all doc-value iterators. Just make sure to never call it on > > decreasing doc IDs. If that doesn't work for you, can you describe you > > use-case, maybe there are better ways to implement what you need. > > > > Le jeu. 12 avr. 2018 =C3=A0 13:54, Yonghui Zhao = a > > =C3=A9crit : > > > > > Hi, > > > > > > I am upgrading my project from Lucene 4 to 7. > > > > > > FieldCache is removed in lucene 7, DocValue is replacement? > > > > > > But seems DocValue doesn't support random access. > > > > > > I need random access to get some specified field value quickly. > > > > > > So how to solve it? > > > > > > --001a11477c04c1fdbd0569b74fe5--