Hi Stephen,

I have the same scenario with you. I verified with simple pure Lucene test,
same way as Mike mentioned, performance with NumericDocValue is 10x faster
than retrieving stored field.
Hope you can get similar performance measurement.


Best regards,
Duke
If not now, when? If not me, who?


On Thu, Oct 24, 2013 at 7:18 AM, Stephen GRAY <stephen.g...@immi.gov.au>wrote:

> UNOFFICIAL
>
> Thanks to Mike and Adrien for the helpful replies.
>
> I actually need to loop through a large number of documents (50,000 -
> 100,000) calculating a number of statistics (min, max, sum) so I really
> need the most efficient/fastest solution available. It sounds like it would
> be best to just store the data in a stored field.
>
> Thanks,
> Steve
>
>
> -----Original Message-----
> From: Michael McCandless [mailto:luc...@mikemccandless.com]
> Sent: Wednesday, 23 October 2013 10:04 PM
> To: Lucene Users
> Subject: Re: Retrieving values for a NumericDocValuesField [SEC=UNOFFICIAL]
>
> You can also use MultiDocValues.getNumericDocValues(reader, field): it
> returns a "wrapper" that will do the binary search on every doc lookup.
>
> If you are only looking up a small number of hits (e.g. the current "page"
> for the user) then typically this cost is fine.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Wed, Oct 23, 2013 at 3:46 AM, Adrien Grand <jpou...@gmail.com> wrote:
> > Hi Stephen,
> >
> > On Wed, Oct 23, 2013 at 9:29 AM, Stephen GRAY <stephen.g...@immi.gov.au>
> wrote:
> >> UNOFFICIAL
> >> Hi everyone,
> >>
> >> I have a question about how to retrieve the values in a
> NumericDocValuesField. I understand how to do this in situations where you
> have an AtomicReaderContext available
> (context.reader().getNumericDocValues(field)). However in a situation where
> I have just done a search and only have a searcher available, and I want to
> get the NumericDocValue in each document returned by the search, is there a
> way to do this?
> >
> > The purpose of doc values is usually scoring, sorting or faceting but
> > here you are willing to actually use them as stored fields. I would
> > recommend storing this numeric field value twice, once as a
> > NumericDocValuesField and once as a StoredField.
> >
> > Otherwise, what you want to do is still possible (but a bad
> > trade-off), for every document, you can find its AtomicReader by
> > calling ReaderUtil.subIndex on the IndexReader.leaves() of your index
> > reader (that you can get from the IndexSearcher by calling
> > IndexSearcher.getIndexReader).
> >
> > --
> > Adrien
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> > For additional commands, e-mail: java-user-h...@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>
> UNOFFICIAL
>
>
> --------------------------------------------------------------------
> Important Notice: If you have received this email by mistake, please advise
> the sender and delete the message and attachments immediately.  This email,
> including attachments, may contain confidential, sensitive, legally
> privileged
> and/or copyright information.  Any review, retransmission, dissemination
> or other use of this information by persons or entities other than the
> intended recipient is prohibited.  DIAC respects your privacy and has
> obligations under the Privacy Act 1988.  The official departmental privacy
> policy can be viewed on the department's website at www.immi.gov.au.  See:
> http://www.immi.gov.au/functional/privacy.htm
>
>
> ---------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

Reply via email to