Documentation ¶
Overview ¶
Package idx implements reading .idx files.
The .idx file contains a list of dictionary entry titles and the associated offset and size of the main article content in the .dict file.
Each .idx file entry (word) comes in three parts:
- The title: a utf-8 string terminated by a null terminator ('\0').
- The offset: a 32 or 64 bit integer offset of the word in the .dict file in network byte order.
- The size: a 32 bit integer size of the word in the .dict file in network byte order.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Idx ¶
type Idx struct {
// contains filtered or unexported fields
}
Idx is a very basic implementation of an in memory search index. Implementers of dictionaries apps or tools may wish to consider using Scanner to read the .idx file and generate their own more robust search index.
func New ¶
func New(r io.ReadCloser, idxoffsetbits int64) (*Idx, error)
New returns a new in-memory index.
func (*Idx) FullTextSearch ¶
FullTextSearch searches full text of index entries.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner scans an index from start to end.
func NewScanner ¶
func NewScanner(r io.ReadCloser, idxoffsetbits int64) (*Scanner, error)
NewScanner return a new index scanner that scans the index from start to end.