github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/codec/compressing/termVectorsFormat.go (about)

     1  package compressing
     2  
     3  import (
     4  	"github.com/balzaczyy/golucene/core/codec/spi"
     5  	"github.com/balzaczyy/golucene/core/index/model"
     6  	"github.com/balzaczyy/golucene/core/store"
     7  )
     8  
     9  // compressing/CompressingTermVectorsFormat.java
    10  
    11  // A TermVectorsFormat that compresses chunks of documents together
    12  // in order to improve the compression ratio.
    13  type CompressingTermVectorsFormat struct {
    14  	formatName      string
    15  	segmentSuffix   string
    16  	compressionMode CompressionMode
    17  	chunkSize       int
    18  }
    19  
    20  /*
    21  Create a new CompressingTermVectorsFormat
    22  
    23  formatName is the name of the format. This name will be used in the
    24  file formats to perform codec header checks.
    25  
    26  The compressionMode parameter allows you to choose between compression
    27  algorithms that have various compression and decompression speeds so
    28  that you can pick the one that best fits your indexing and searching
    29  throughput. You should never instantiate two CompressingTermVectorsFormats
    30  that have the same name but different CompressionModes.
    31  
    32  chunkSize is the minimum byte size of a chunk of documents. Highter
    33  values of chunkSize should improve the compression ratio but will
    34  require more memory at indexing time and might make document loading
    35  a little slower (depending on the size of your OS cache compared to
    36  the size of your index).
    37  */
    38  func NewCompressingTermVectorsFormat(formatName, segmentSuffix string,
    39  	compressionMode CompressionMode, chunkSize int) *CompressingTermVectorsFormat {
    40  	assert2(chunkSize >= 1, "chunkSize must be >= 1")
    41  	return &CompressingTermVectorsFormat{
    42  		formatName:      formatName,
    43  		segmentSuffix:   segmentSuffix,
    44  		compressionMode: compressionMode,
    45  		chunkSize:       chunkSize,
    46  	}
    47  }
    48  
    49  func (vf *CompressingTermVectorsFormat) VectorsReader(d store.Directory,
    50  	segmentInfo *model.SegmentInfo, fieldsInfos model.FieldInfos,
    51  	context store.IOContext) (spi.TermVectorsReader, error) {
    52  
    53  	panic("not implemented yet")
    54  }
    55  
    56  func (vf *CompressingTermVectorsFormat) VectorsWriter(d store.Directory,
    57  	segmentInfo *model.SegmentInfo,
    58  	context store.IOContext) (spi.TermVectorsWriter, error) {
    59  
    60  	panic("not implemented yet")
    61  }