Documentation
¶
Index ¶
- Constants
- func CompareTrees(local *MerkleNode, remote *MerkleNode, divergent *[]ultimate_db.PageID)
- func ComputePageHashes(ctx context.Context, db *ultimate_db.DB, pageIDs []ultimate_db.PageID, ...) (map[ultimate_db.PageID]MerkleHash, error)
- func CountLeaves(root *MerkleNode) int
- func DiffTrees(local *MerkleTree, remote *MerkleTree) []ultimate_db.PageID
- func TreeDepth(root *MerkleNode) int
- func ValidateTree(root *MerkleNode) bool
- type Analyzer
- type BM25Scorer
- type ClusterQuery
- type Engine
- func (e *Engine) Index(docID string, text string) error
- func (e *Engine) IndexSecureData(docID string, script string, profileType string, target string) error
- func (e *Engine) NetNode() *secure_network.MeshNode
- func (e *Engine) ScatterGather(ctx context.Context, query string, limit int) ([]SearchResult, error)
- func (e *Engine) Search(query string, limit int) ([]SearchResult, error)
- type EngineState
- type Indexer
- type MerkleHash
- type MerkleNode
- type MerkleSyncRequest
- type MerkleSyncResponse
- type MerkleTree
- type Posting
- type RoutingEntry
- type SDFProfile
- type SearchResult
- type Shard
Constants ¶
const ( DefaultVirtualNodes = 64 MaxShardReplicas = 3 )
const IndexPageID ultimate_db.PageID = 10
IndexPageID is strictly reserved for inverted index postings to avoid collisions
const MetadataPageID ultimate_db.PageID = 11
Variables ¶
This section is empty.
Functions ¶
func CompareTrees ¶
func CompareTrees( local *MerkleNode, remote *MerkleNode, divergent *[]ultimate_db.PageID, )
func ComputePageHashes ¶
func ComputePageHashes( ctx context.Context, db *ultimate_db.DB, pageIDs []ultimate_db.PageID, workers int, ) (map[ultimate_db.PageID]MerkleHash, error)
func CountLeaves ¶
func CountLeaves(root *MerkleNode) int
func DiffTrees ¶
func DiffTrees( local *MerkleTree, remote *MerkleTree, ) []ultimate_db.PageID
func TreeDepth ¶
func TreeDepth(root *MerkleNode) int
func ValidateTree ¶
func ValidateTree(root *MerkleNode) bool
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
Analyzer processes raw text into indexable tokens. It is completely stateless and safe for concurrent use across multiple indexing goroutines.
func NewAnalyzer ¶
func NewAnalyzer() *Analyzer
NewAnalyzer initializes the analyzer with default stop words.
type BM25Scorer ¶
type BM25Scorer struct {
// contains filtered or unexported fields
}
BM25Scorer implements the Okapi BM25 ranking function. It is cluster-safe, deterministic, and optimized to score both unstructured text terms and namespaced SDF (Secure Data Format) structural facets.
func NewBM25Scorer ¶
func NewBM25Scorer() *BM25Scorer
NewBM25Scorer creates a scorer using Lucene-compatible defaults.
func (*BM25Scorer) Score ¶
func (s *BM25Scorer) Score( tf float64, docLen float64, avgDocLen float64, totalDocs int, docFreq int, ) float64
Score calculates the relevance score for a given token or structural facet.
Parameters:
tf -> term frequency inside document docLen -> total token count for document (including structural metadata) avgDocLen -> average token count across corpus totalDocs -> total indexed documents docFreq -> number of docs containing the term/facet
BM25 Formula:
IDF * ((tf * (k1 + 1)) / (tf + k1 * (1 - b + b * (docLen / avgDocLen))))
type ClusterQuery ¶
type Engine ¶
func NewEngine ¶
func NewEngine( db *ultimate_db.DB, node *secure_network.MeshNode, sysLog *logger.LogDispatcher, ) (*Engine, error)
func NewEngineWithNode ¶
func NewEngineWithNode( db *ultimate_db.DB, sdEngine *secure_data_format.SecureDataEngine, signerKey []byte, sysLog *logger.LogDispatcher, ) (*Engine, error)
func (*Engine) IndexSecureData ¶
func (*Engine) NetNode ¶
func (e *Engine) NetNode() *secure_network.MeshNode
func (*Engine) ScatterGather ¶
type EngineState ¶
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer bridges the NLP analyzer pipeline and the ultimate_db storage layer.
func NewIndexer ¶
func NewIndexer(db *ultimate_db.DB, analyzer *Analyzer) *Indexer
NewIndexer initializes the pipeline worker
func (*Indexer) AddDocument ¶
AddDocument tokenizes raw text, calculates term frequencies, and returns organized maps to prevent write amplification inside lower storage layers.
type MerkleHash ¶
type MerkleHash [32]byte
func ComputePageHash ¶
func ComputePageHash( ctx context.Context, db *ultimate_db.DB, id ultimate_db.PageID, ) (MerkleHash, error)
func ZeroHash ¶
func ZeroHash() MerkleHash
func (MerkleHash) String ¶
func (m MerkleHash) String() string
type MerkleNode ¶
type MerkleNode struct {
Hash MerkleHash
Left *MerkleNode
Right *MerkleNode
Parent *MerkleNode
PageID ultimate_db.PageID
Leaf bool
Timestamp int64
}
func FlattenTree ¶
func FlattenTree(root *MerkleNode) []*MerkleNode
func (*MerkleNode) IsLeaf ¶
func (m *MerkleNode) IsLeaf() bool
type MerkleSyncRequest ¶
type MerkleSyncResponse ¶
type MerkleTree ¶
type MerkleTree struct {
Root *MerkleNode
PageCount int
CreatedAt time.Time
}
func BuildTree ¶
func BuildTree( ctx context.Context, db *ultimate_db.DB, pageIDs []ultimate_db.PageID, ) (*MerkleTree, error)
func (*MerkleTree) RootHash ¶
func (t *MerkleTree) RootHash() MerkleHash
type Posting ¶
Posting represents a single document's relationship to a specific term. This holds the exact metrics needed for the BM25 scorer.
type RoutingEntry ¶
RoutingEntry represents a peer that owns shards within the FabricStack cluster.
type SDFProfile ¶
type SDFProfile string
SDFProfile defines the supported structural classifications for the Secure Data Format.
const ( ProfileStructuredLog SDFProfile = "LOG" ProfileGrant SDFProfile = "GRANT" ProfileProofOfPoss SDFProfile = "POP" )