Documentation
¶
Index ¶
- type Document
- type InvertedIndex
- func (idx *InvertedIndex) AddDocument(doc *Document, tokens []string, positions []int)
- func (idx *InvertedIndex) Deserialize(data []byte) error
- func (idx *InvertedIndex) FuzzySearch(queryTerms []string, maxDistance int) []SearchResult
- func (idx *InvertedIndex) GetDocument(docID string) (*Document, bool)
- func (idx *InvertedIndex) GetStats() Stats
- func (idx *InvertedIndex) RemoveDocument(docID string)
- func (idx *InvertedIndex) Search(queryTerms []string) []SearchResult
- func (idx *InvertedIndex) Serialize() ([]byte, error)
- type Posting
- type SearchResult
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvertedIndex ¶
type InvertedIndex struct {
// contains filtered or unexported fields
}
InvertedIndex stores the inverted index structure
func NewInvertedIndex ¶
func NewInvertedIndex() *InvertedIndex
NewInvertedIndex creates a new inverted index
func (*InvertedIndex) AddDocument ¶
func (idx *InvertedIndex) AddDocument(doc *Document, tokens []string, positions []int)
AddDocument adds or updates a document in the index
func (*InvertedIndex) Deserialize ¶
func (idx *InvertedIndex) Deserialize(data []byte) error
Deserialize decodes the index from storage
func (*InvertedIndex) FuzzySearch ¶
func (idx *InvertedIndex) FuzzySearch(queryTerms []string, maxDistance int) []SearchResult
FuzzySearch performs fuzzy matching search
func (*InvertedIndex) GetDocument ¶
func (idx *InvertedIndex) GetDocument(docID string) (*Document, bool)
GetDocument retrieves a document by ID
func (*InvertedIndex) GetStats ¶
func (idx *InvertedIndex) GetStats() Stats
GetStats returns index statistics
func (*InvertedIndex) RemoveDocument ¶
func (idx *InvertedIndex) RemoveDocument(docID string)
RemoveDocument removes a document from the index
func (*InvertedIndex) Search ¶
func (idx *InvertedIndex) Search(queryTerms []string) []SearchResult
Search performs a search query and returns ranked results
func (*InvertedIndex) Serialize ¶
func (idx *InvertedIndex) Serialize() ([]byte, error)
Serialize encodes the index for storage
type SearchResult ¶
SearchResult represents a search result with scoring
Click to show internal directories.
Click to hide internal directories.