Hi, Could you please explain how to store the SortedNumericDocValuesField to include in the code?
Thanks, Chitra On Tue, May 31, 2016 at 3:02 PM, Chitra R <chithu.r...@gmail.com> wrote: > Thanks..... > > On Fri, May 27, 2016 at 6:02 PM, Adrien Grand <jpou...@gmail.com> wrote: > >> DocValues.getSortedNumeric is indeed not really useful for high-level >> code, >> such as you example which is getting the sort values for each top hit. >> However, if you wanted to implement lower level functionality like >> building >> a histogram of the prices of all matching documents, you would need to >> build a custom collector and use these sorted numeric doc values to get >> the >> prices. >> >> Le ven. 27 mai 2016 à 14:10, Chitra R <chithu.r...@gmail.com> a écrit : >> >> > Hi, >> > >> > i have achieved the same sorting using >> > >> > Sort sort = new Sort(new >> SortedNumericSortField("Numericdoc_price", >> > > SortField.Type.LONG,true)); >> > > int maxDoc = searcher.getIndexReader().maxDoc(); >> > > TopFieldDocs topdocs =searcher.search(query, 10,sort); >> > > >> > > for (ScoreDoc scoreDoc : topdocs.scoreDocs) { >> > > doc = reader.document(scoreDoc.doc); >> > > System.out.println(scoreDoc); >> > > } >> > > >> > >> > >> > So what is the purpose of sortedDocValues obtained >> > from DocValues.getSortedNumeric(atomicReader, "Numericdoc_price"); >> > >> > >> > >> > >> > >> > Thanks, >> > Chitra >> > >> > >> > On Fri, May 27, 2016 at 3:18 PM, Chitra R <chithu.r...@gmail.com> >> wrote: >> > >> > > Hi, >> > > Actually I like to print the sorted numeric list from the >> > > sortedDocValues and I dont know which api have to use . Could you >> please >> > > help me to achieve this? >> > > >> > > >> > > Thanks, >> > > Chitra >> > > >> > > On Thu, May 26, 2016 at 8:17 PM, Michael McCandless < >> > > luc...@mikemccandless.com> wrote: >> > > >> > >> This looks about right ... did something go wrong? >> > >> >> > >> Mike McCandless >> > >> >> > >> http://blog.mikemccandless.com >> > >> >> > >> On Thu, May 26, 2016 at 9:29 AM, Chitra R <chithu.r...@gmail.com> >> > wrote: >> > >> >> > >> > Hi, >> > >> > I am new to lucene. Anyone please explain how to sort the >> > numeric >> > >> > values by SortedNumericDocValuesField? >> > >> > >> > >> > I tried like this using Lucene 4.10.4: >> > >> > >> > >> > doc.add(new SortedNumericDocValuesField("Numericdoc_price", 1L)); >> > >> > doc.add(new SortedNumericDocValuesField("Numericdoc_price", 15L)); >> > >> > .. >> > >> > for (AtomicReaderContext context : indexReader.leaves()) { >> > >> > AtomicReader atomicReader = context.reader(); >> > >> > SortedNumericDocValues >> > >> > sortedDocValues=DocValues.getSortedNumeric(atomicReader, >> > >> > "Numericdoc_price"); >> > >> > } >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > Thanks, >> > >> > Chitra >> > >> > >> > >> >> > > >> > > >> > >> > >