[ https://issues.apache.org/jira/browse/LUCENE-4539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491020#comment-13491020 ]
Robert Muir commented on LUCENE-4539: ------------------------------------- I think you are probably right... I just got the straightforward ones done. I wanted to suggest a possibility that maybe we add PackedInts.Header to encapsulate what it stores? Today we have: {code} Reader getReader(DataInput in) Reader getReaderNoHeader(DataInput in, Format format, int version, int valueCount, int bitsPerValue) {code} And if you want to read in the header yourself, you are doing: {code} final int version = CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_CURRENT); final int bitsPerValue = in.readVInt(); assert bitsPerValue > 0 && bitsPerValue <= 64: "bitsPerValue=" + bitsPerValue; final int valueCount = in.readVInt(); final Format format = Format.byId(in.readVInt()); {code} So my idea would just be something like: {code} Reader getReader(DataInput in, Header header) { return getReader(in, header.format, header.version, header.valueCount, header.bitsPerValue); } {code} and maybe {code} Header readHeader(DataInput in) {code} to encapsulate this stuff. we could still keep the "raw" versions around if we wanted too. I didnt want to overengineer anything, not sure if this would be useful outside of this particular issue. > DocValues impls should read all headers up-front instead of per-directsource > ---------------------------------------------------------------------------- > > Key: LUCENE-4539 > URL: https://issues.apache.org/jira/browse/LUCENE-4539 > Project: Lucene - Core > Issue Type: Bug > Components: core/index > Reporter: Robert Muir > Attachments: LUCENE-4539.patch > > > Currently, when DocValues opens, it just opens files. it doesnt read codec > headers etc. > Instead we read these every single time a directsource opens. > I think it should work like PostingsReaders: e.g. the PackedInts impl would > read its versioning info and codec headers and creating a new Direct impl > should be a IndexInput.clone() + getDirectReaderNoHeader(). > Today its much more costly. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org