| Type: | Package |
| Title: | Lightweight Vector Database with Embedded Machine Learning Models |
| Version: | 1.1.2 |
| Author: | Kwadwo Daddy Nyame Owusu Boakye [aut, cre] |
| Maintainer: | Kwadwo Daddy Nyame Owusu Boakye <kwadwo.owusuboakye@outlook.com> |
| Description: | A lightweight vector database for text retrieval in R with embedded machine learning models and no external API (Application Programming Interface) keys. Supports dense and hybrid search, optional HNSW (Hierarchical Navigable Small World) approximate nearest-neighbor indexing, faceted filters with ACL (Access Control List) metadata, command-line tools, and a local dashboard built with 'shiny'. The HNSW method is described by Malkov and Yashunin (2018) <doi:10.1109/TPAMI.2018.2889473>. |
| License: | Apache License (≥ 2) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Imports: | R6, jsonlite, digest, Matrix, text2vec (≥ 0.6.0), stopwords, tools, utils, stats, RSQLite, DBI |
| Suggests: | testthat (≥ 3.0.0), shiny, plumber, pkgdown, RcppAnnoy, reticulate, rappdirs |
| Config/testthat/edition: | 3 |
| URL: | https://knowusuboaky.github.io/vectrixdb-r/, https://github.com/knowusuboaky/vectrixdb-r |
| BugReports: | https://github.com/knowusuboaky/vectrixdb-r/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-02-18 19:10:48 UTC; kwadw |
| Repository: | CRAN |
| Date/Publication: | 2026-02-20 11:40:19 UTC |
VectrixDB: Lightweight Vector Database with Embedded Machine Learning Models
Description
A lightweight vector database for text retrieval in R with embedded machine learning models and no external API (Application Programming Interface) keys. Supports dense and hybrid search, optional HNSW (Hierarchical Navigable Small World) approximate nearest-neighbor indexing, faceted filters with ACL (Access Control List) metadata, command-line tools, and a local dashboard built with 'shiny'.
VectrixDB is a lightweight vector database with embedded machine learning models that do not require external API (application programming interface) keys. It supports dense, hybrid, and graph-based search modes and includes a built-in dashboard.
Main Functions
-
Vectrix- Simple API for text-in, results-out workflow -
VectrixDB- Advanced database interface -
Collection- Vector collection management -
vectrix_serve- Start REST API server
Search Modes
dense - Semantic vector search
sparse - BM25 keyword search
hybrid - Combined dense + sparse
ultimate - Full pipeline with reranking
neural - ColBERT + cross-encoder
Author(s)
Maintainer: Kwadwo Daddy Nyame Owusu Boakye kwadwo.owusuboakye@outlook.com
See Also
Useful links:
Report bugs at https://github.com/knowusuboaky/vectrixdb-r/issues
Examples
## Not run:
# Simple usage
db <- Vectrix$new("my_docs")
db$add(c("Python is great", "R is awesome", "Julia is fast"))
results <- db$search("programming language")
print(results$top()$text)
## End(Not run)
ACL Configuration
Description
ACL configuration for a document or collection
Public fields
read_principalsWho can read
deny_principalsWho cannot read (takes precedence)
is_publicIs public access allowed
Methods
Public methods
Method new()
Create a new ACLConfig
Usage
ACLConfig$new( read_principals = list(), deny_principals = list(), is_public = FALSE )
Arguments
read_principalsList of ACLPrincipal objects
deny_principalsList of ACLPrincipal objects
is_publicLogical
Method clone()
The objects of this class are cloneable with this method.
Usage
ACLConfig$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
ACL Filter
Description
Access Control List filter for security-aware search
Public fields
acl_fieldMetadata field containing ACLs
Methods
Public methods
Method new()
Create a new ACLFilter
Usage
ACLFilter$new(acl_field = "_acl")
Arguments
acl_fieldField name for ACLs (default: "_acl")
Method filter()
Filter documents based on user's ACL principals
Usage
ACLFilter$filter(documents, user_principals, default_allow = FALSE)
Arguments
documentsList of documents with metadata
user_principalsCharacter vector or list of ACLPrincipal
default_allowAllow if no ACL defined (default: FALSE)
Returns
Filtered documents
Method add_acl()
Add ACL to document metadata
Usage
ACLFilter$add_acl(metadata, principals)
Arguments
metadataDocument metadata
principalsCharacter vector of principal strings
Returns
Updated metadata
Method create_filter_condition()
Create ACL filter condition for query
Usage
ACLFilter$create_filter_condition(user_principals)
Arguments
user_principalsCharacter vector of principals
Returns
Filter condition list
Method clone()
The objects of this class are cloneable with this method.
Usage
ACLFilter$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
acl_filter <- ACLFilter$new()
filtered <- acl_filter$filter(
documents = results,
user_principals = c("user:alice", "group:engineering")
)
## End(Not run)
ACL Operator Types
Description
ACL matching operators
Usage
ACLOperator
Format
An object of class list of length 5.
ACL Principal
Description
An ACL principal (user, group, or role)
Public fields
typePrincipal type
valuePrincipal value
Methods
Public methods
Method new()
Create a new ACLPrincipal
Usage
ACLPrincipal$new(type, value)
Arguments
typePrincipal type (user, group, role)
valuePrincipal value
Method matches()
Check if this principal matches another
Usage
ACLPrincipal$matches(other)
Arguments
otherAnother ACLPrincipal
Returns
Logical
Method to_string()
Convert to string
Usage
ACLPrincipal$to_string()
Method clone()
The objects of this class are cloneable with this method.
Usage
ACLPrincipal$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Advanced Reranker with Learned Weights
Description
Combines multiple signals for better reranking:
Semantic similarity (word vectors)
BM25/keyword overlap
Query coverage
Position bias
Length normalization
Public fields
weightsFeature weights
Methods
Public methods
Method new()
Create a new AdvancedReranker
Usage
AdvancedReranker$new( semantic_weight = 0.4, bm25_weight = 0.3, coverage_weight = 0.2, position_weight = 0.1, sentence_embedder = NULL )
Arguments
semantic_weightWeight for semantic similarity (0-1)
bm25_weightWeight for BM25 score (0-1)
coverage_weightWeight for query term coverage (0-1)
position_weightWeight for position bias (0-1)
sentence_embedderOptional SentenceEmbedder for semantic scoring
Method set_embedder()
Set sentence embedder
Usage
AdvancedReranker$set_embedder(embedder)
Arguments
embedderSentenceEmbedder object
Method rerank()
Rerank results
Usage
AdvancedReranker$rerank( query, query_vector = NULL, results, doc_vectors = NULL, limit = 10 )
Arguments
queryQuery text
query_vectorQuery embedding vector
resultsList of result objects with id, text, score
doc_vectorsMatrix of document vectors (optional)
limitNumber of results to return
Returns
Reranked list of results
Method learn_weights()
Learn optimal weights from relevance judgments
Usage
AdvancedReranker$learn_weights( queries, results_list, relevance_list, iterations = 100 )
Arguments
queriesCharacter vector of queries
results_listList of result lists (one per query)
relevance_listList of relevance scores (1=relevant, 0=not)
iterationsNumber of optimization iterations
Method clone()
The objects of this class are cloneable with this method.
Usage
AdvancedReranker$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Analyzer Chain
Description
Chain multiple analyzers together
Public fields
analyzersList of TextAnalyzer objects
Methods
Public methods
Method new()
Create a new AnalyzerChain
Usage
AnalyzerChain$new(analyzers)
Arguments
analyzersList of TextAnalyzer objects
Method analyze()
Run text through all analyzers
Usage
AnalyzerChain$analyze(text)
Arguments
textInput text
Returns
Character vector of tokens
Method clone()
The objects of this class are cloneable with this method.
Usage
AnalyzerChain$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Base Cache
Description
Abstract base class for cache backends
Public fields
configCache configuration
statsCache statistics
Methods
Public methods
Method new()
Create a new cache
Usage
BaseCache$new(config = NULL)
Arguments
configCacheConfig object
Method get()
Get a value from cache
Usage
BaseCache$get(key)
Arguments
keyCache key
Returns
Cached value or NULL
Method set()
Set a value in cache
Usage
BaseCache$set(key, value, ttl = NULL)
Arguments
keyCache key
valueValue to cache
ttlTime to live (optional)
Method delete()
Delete a key from cache
Usage
BaseCache$delete(key)
Arguments
keyCache key
Returns
Logical success
Method exists()
Check if key exists
Usage
BaseCache$exists(key)
Arguments
keyCache key
Returns
Logical
Method clear()
Clear all cache entries
Usage
BaseCache$clear()
Method size()
Get cache size
Usage
BaseCache$size()
Returns
Integer count
Method get_many()
Get multiple values
Usage
BaseCache$get_many(keys)
Arguments
keysCharacter vector of keys
Returns
Named list of values
Method set_many()
Set multiple values
Usage
BaseCache$set_many(items, ttl = NULL)
Arguments
itemsNamed list of values
ttlTime to live
Method delete_many()
Delete multiple keys
Usage
BaseCache$delete_many(keys)
Arguments
keysCharacter vector of keys
Returns
Integer count of deleted keys
Method make_key()
Make a prefixed key
Usage
BaseCache$make_key(key)
Arguments
keyRaw key
Returns
Prefixed key
Method clone()
The objects of this class are cloneable with this method.
Usage
BaseCache$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
CLI Configuration
Description
Configuration for CLI behavior
Public fields
verbosePrint verbose output
colorUse colored output
data_dirDefault data directory
Methods
Public methods
Method new()
Create CLI config
Usage
CLIConfig$new(verbose = TRUE, color = TRUE, data_dir = NULL)
Arguments
verboseVerbose output
colorColored output
data_dirData directory
Method clone()
The objects of this class are cloneable with this method.
Usage
CLIConfig$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Cache Backend Types
Description
Available cache backends
Usage
CacheBackend
Format
An object of class list of length 3.
Cache Configuration
Description
Configuration for cache layer
Public fields
backendCache backend type
memory_max_sizeMax items in memory
memory_ttl_secondsDefault TTL in seconds
file_cache_dirDirectory for file cache
file_ttl_secondsFile cache TTL
prefixCache key prefix
compressionUse compression
Methods
Public methods
Method new()
Create a new CacheConfig
Usage
CacheConfig$new( backend = "memory", memory_max_size = 10000, memory_ttl_seconds = 3600, file_cache_dir = NULL, file_ttl_seconds = 86400, prefix = "vectrix:", compression = TRUE )
Arguments
backendBackend type
memory_max_sizeMax memory items
memory_ttl_secondsMemory TTL
file_cache_dirFile cache directory
file_ttl_secondsFile TTL
prefixKey prefix
compressionUse compression
Method clone()
The objects of this class are cloneable with this method.
Usage
CacheConfig$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Cache Entry
Description
A cached entry with metadata
Public fields
valueCached value
created_atCreation timestamp
ttlTime to live in seconds
hitsNumber of hits
Methods
Public methods
Method new()
Create a new CacheEntry
Usage
CacheEntry$new(value, ttl)
Arguments
valueThe value to cache
ttlTime to live in seconds
Method is_expired()
Check if entry is expired
Usage
CacheEntry$is_expired()
Returns
Logical
Method clone()
The objects of this class are cloneable with this method.
Usage
CacheEntry$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Cache Statistics
Description
Cache statistics for monitoring
Public fields
hitsCache hits
missesCache misses
setsCache sets
deletesCache deletes
evictionsCache evictions
Methods
Public methods
Method record_hit()
Record a cache hit
Usage
CacheStats$record_hit()
Method record_miss()
Record a cache miss
Usage
CacheStats$record_miss()
Method record_set()
Record a cache set
Usage
CacheStats$record_set()
Method record_delete()
Record a cache delete
Usage
CacheStats$record_delete()
Method record_eviction()
Record a cache eviction
Usage
CacheStats$record_eviction()
Method hit_rate()
Get hit rate
Usage
CacheStats$hit_rate()
Returns
Numeric hit rate
Method to_list()
Convert to list
Usage
CacheStats$to_list()
Returns
List representation
Method reset()
Reset statistics
Usage
CacheStats$reset()
Method clone()
The objects of this class are cloneable with this method.
Usage
CacheStats$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Collection Class
Description
Vector collection with indexing and search
Public fields
nameCollection name
dimensionVector dimension
metricDistance metric
languageLanguage setting ("en" or "ml")
Methods
Public methods
Method new()
Create a new Collection
Usage
Collection$new( name, dimension, metric = "cosine", storage = NULL, language = "en" )
Arguments
nameCollection name
dimensionVector dimension
metricDistance metric
storageStorage backend
languageLanguage behavior ("en" = ASCII-focused, "ml" = Unicode-aware)
Method add()
Add documents to collection
Usage
Collection$add(ids, vectors, metadata = NULL, texts = NULL)
Arguments
idsDocument IDs
vectorsMatrix of vectors
metadataList of metadata
textsCharacter vector of texts
Method search()
Search collection
Usage
Collection$search(query, limit = 10, filter = NULL, include_vectors = FALSE)
Arguments
queryQuery vector
limitNumber of results
filterMetadata filter
include_vectorsInclude vectors in results
Returns
Results object
Method keyword_search()
Keyword search
Usage
Collection$keyword_search(query_text, limit = 10, filter = NULL)
Arguments
query_textQuery text
limitNumber of results
filterMetadata filter
Returns
Results object
Method hybrid_search()
Hybrid search (dense + sparse)
Usage
Collection$hybrid_search( query, query_text, limit = 10, vector_weight = 0.5, text_weight = 0.5, filter = NULL, include_vectors = FALSE, rrf_k = 60, prefetch_multiplier = 10 )
Arguments
queryQuery vector
query_textQuery text
limitNumber of results
vector_weightWeight for vector search
text_weightWeight for text search
filterMetadata filter
include_vectorsInclude vectors in results
rrf_kRRF constant
prefetch_multiplierPrefetch multiplier
Returns
Results object
Method get()
Get documents by ID
Usage
Collection$get(ids)
Arguments
idsDocument IDs
Returns
List of results
Method delete()
Delete documents by ID
Usage
Collection$delete(ids)
Arguments
idsDocument IDs to delete
Method count()
Get document count
Usage
Collection$count()
Returns
Integer count
Method clear()
Clear collection
Usage
Collection$clear()
Method clone()
The objects of this class are cloneable with this method.
Usage
Collection$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Community
Description
A community of entities
Public fields
idCommunity ID
levelHierarchy level
entity_idsMember entity IDs
summaryCommunity summary
parent_idParent community ID
child_idsChild community IDs
Methods
Public methods
Method new()
Create a new Community
Usage
Community$new( id, level = 0, entity_ids = character(0), summary = NULL, parent_id = NULL )
Arguments
idID
levelLevel
entity_idsMembers
summarySummary
parent_idParent
Method size()
Get size
Usage
Community$size()
Returns
Integer
Method clone()
The objects of this class are cloneable with this method.
Usage
Community$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Simple Community Detector
Description
Detects communities using connected components
Public fields
min_sizeMinimum community size
max_levelsMaximum hierarchy levels
Methods
Public methods
Method new()
Create a new CommunityDetector
Usage
CommunityDetector$new(min_size = 5, max_levels = 3)
Arguments
min_sizeMin size
max_levelsMax levels
Method detect()
Detect communities in graph
Usage
CommunityDetector$detect(graph)
Arguments
graphKnowledgeGraph object
Returns
List of Community objects
Method clone()
The objects of this class are cloneable with this method.
Usage
CommunityDetector$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Dense Embedder using word2vec or GloVe
Description
Generates dense vector embeddings using pre-trained word vectors
Public fields
dimensionEmbedding dimension
model_typeType of model being used
languageLanguage setting ("en" or "ml")
Methods
Public methods
Method new()
Create a new DenseEmbedder
Usage
DenseEmbedder$new( dimension = 100, model_path = NULL, model_type = "tfidf", sentence_embedder = NULL, auto_download = FALSE, language = "en" )
Arguments
dimensionVector dimension (default: 100 for word2vec, 50/100/200/300 for GloVe)
model_pathOptional path to pre-trained model file
model_typeType: "word2vec", "glove", "glove-pretrained", or "tfidf"
sentence_embedderOptional SentenceEmbedder object to use
auto_downloadAuto-download GloVe vectors if model_type is glove-pretrained
languageLanguage behavior ("en" = ASCII-focused, "ml" = Unicode-aware)
Method set_sentence_embedder()
Set a SentenceEmbedder to use for embeddings
Usage
DenseEmbedder$set_sentence_embedder(embedder)
Arguments
embedderSentenceEmbedder object
Method embed()
Embed texts to vectors
Usage
DenseEmbedder$embed(texts)
Arguments
textsCharacter vector of texts
Returns
Matrix of embeddings (rows are documents)
Method fit()
Train embedder on corpus (for TF-IDF)
Usage
DenseEmbedder$fit(texts)
Arguments
textsCharacter vector of training texts
Method clone()
The objects of this class are cloneable with this method.
Usage
DenseEmbedder$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Distance Metric Enumeration
Description
Available distance metrics for vector comparison
Usage
DistanceMetric
Format
An object of class list of length 4.
Document Chunker
Description
Splits documents into text units
Public fields
chunk_sizeTarget chunk size
chunk_overlapOverlap size
by_sentencePreserve sentences
Methods
Public methods
Method new()
Create a new DocumentChunker
Usage
DocumentChunker$new(chunk_size = 1200, chunk_overlap = 100, by_sentence = TRUE)
Arguments
chunk_sizeTarget size
chunk_overlapOverlap
by_sentencePreserve sentences
Method chunk()
Chunk a document
Usage
DocumentChunker$chunk(text, document_id = NULL)
Arguments
textDocument text
document_idDocument ID
Returns
List of TextUnit objects
Method clone()
The objects of this class are cloneable with this method.
Usage
DocumentChunker$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
English Stopwords
Description
Common English stopwords
Usage
ENGLISH_STOPWORDS
Format
An object of class character of length 45.
Enhanced Search Results
Description
Search results with enterprise features
Public fields
resultsList of result items
facetsNamed list of FacetResult objects
total_countTotal results before filtering
filtered_countResults after ACL filtering
query_time_msQuery time in milliseconds
rerank_time_msRerank time in milliseconds
facet_time_msFacet time in milliseconds
Methods
Public methods
Method new()
Create new EnhancedSearchResults
Usage
EnhancedSearchResults$new( results, facets = list(), total_count = 0, filtered_count = 0, query_time_ms = 0, rerank_time_ms = 0, facet_time_ms = 0 )
Arguments
resultsList of results
facetsNamed list of FacetResult
total_countTotal count
filtered_countFiltered count
query_time_msQuery time
rerank_time_msRerank time
facet_time_msFacet time
Method to_list()
Convert to list
Usage
EnhancedSearchResults$to_list()
Returns
List representation
Method clone()
The objects of this class are cloneable with this method.
Usage
EnhancedSearchResults$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Entity
Description
An extracted entity
Public fields
idUnique identifier
nameEntity name
typeEntity type
descriptionDescription
source_chunksSource chunk IDs
embeddingVector embedding
metadataAdditional metadata
Methods
Public methods
Method new()
Create a new Entity
Usage
Entity$new( id = NULL, name, type, description = NULL, source_chunks = NULL, embedding = NULL, metadata = NULL )
Arguments
idUnique ID
nameName
typeType
descriptionDescription
source_chunksSources
embeddingVector
metadataMetadata
Method to_list()
Convert to list
Usage
Entity$to_list()
Method clone()
The objects of this class are cloneable with this method.
Usage
Entity$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Extraction Result
Description
Result of entity extraction
Public fields
entitiesList of Entity objects
relationshipsList of Relationship objects
source_chunkSource chunk ID
Methods
Public methods
Method new()
Create new ExtractionResult
Usage
ExtractionResult$new( entities = list(), relationships = list(), source_chunk = NULL )
Arguments
entitiesEntities
relationshipsRelationships
source_chunkSource
Method clone()
The objects of this class are cloneable with this method.
Usage
ExtractionResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Extractor Types
Description
Extractor Types
Usage
ExtractorType
Format
An object of class list of length 4.
Facet Aggregator
Description
Faceted search aggregator for computing aggregations/counts
Methods
Public methods
Method aggregate()
Aggregate facet values from documents
Usage
FacetAggregator$aggregate(documents, facet_configs)
Arguments
documentsList of documents with metadata
facet_configsList of field names or FacetConfig objects
Returns
Named list mapping field names to FacetResult
Method to_list()
Convert facet results to list format
Usage
FacetAggregator$to_list(facet_results)
Arguments
facet_resultsNamed list of FacetResult objects
Returns
List format suitable for JSON
Method clone()
The objects of this class are cloneable with this method.
Usage
FacetAggregator$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
aggregator <- FacetAggregator$new()
facets <- aggregator$aggregate(
documents = list(
list(category = "tech", author = "Alice"),
list(category = "science", author = "Bob")
),
facet_fields = c("category", "author")
)
## End(Not run)
Facet Configuration
Description
Configuration for a facet field
Public fields
fieldField name to facet on
limitMax values to return
min_countMinimum count to include
sort_bySort by "count" or "value"
include_zeroInclude zero-count values
Methods
Public methods
Method new()
Create a new FacetConfig
Usage
FacetConfig$new( field, limit = 10, min_count = 1, sort_by = "count", include_zero = FALSE )
Arguments
fieldField name
limitMax values (default: 10)
min_countMin count (default: 1)
sort_bySort method (default: "count")
include_zeroInclude zeros (default: FALSE)
Method clone()
The objects of this class are cloneable with this method.
Usage
FacetConfig$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Facet Result
Description
Result of facet aggregation
Public fields
fieldField name
valuesList of FacetValue objects
total_countTotal count
other_countCount of values not in top-N
Methods
Public methods
Method new()
Create a new FacetResult
Usage
FacetResult$new(field, values, total_count, other_count = 0)
Arguments
fieldField name
valuesList of FacetValue objects
total_countTotal count
other_countOther count
Method to_list()
Convert to list
Usage
FacetResult$to_list()
Method clone()
The objects of this class are cloneable with this method.
Usage
FacetResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Facet Value
Description
A single facet value with count
Public fields
valueThe facet value
countNumber of occurrences
Methods
Public methods
Method new()
Create a new FacetValue
Usage
FacetValue$new(value, count)
Arguments
valueThe value
countThe count
Method clone()
The objects of this class are cloneable with this method.
Usage
FacetValue$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
File Cache
Description
File-based persistent cache using RDS files
Super class
VectrixDB::BaseCache -> FileCache
Methods
Public methods
Inherited methods
Method new()
Create a new FileCache
Usage
FileCache$new(config = NULL)
Arguments
configCacheConfig object
Method get()
Get value from cache
Usage
FileCache$get(key)
Arguments
keyCache key
Returns
Value or NULL
Method set()
Set value in cache
Usage
FileCache$set(key, value, ttl = NULL)
Arguments
keyCache key
valueValue to cache
ttlTime to live
Method delete()
Delete key from cache
Usage
FileCache$delete(key)
Arguments
keyCache key
Returns
Logical success
Method exists()
Check if key exists
Usage
FileCache$exists(key)
Arguments
keyCache key
Returns
Logical
Method clear()
Clear cache
Usage
FileCache$clear()
Method size()
Get cache size
Usage
FileCache$size()
Returns
Integer
Method cleanup_expired()
Cleanup expired entries
Usage
FileCache$cleanup_expired()
Returns
Integer count removed
Method clone()
The objects of this class are cloneable with this method.
Usage
FileCache$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Filter Class for Metadata Filtering
Description
Build metadata filters for search queries
Public fields
conditionsList of filter conditions
Methods
Public methods
Method new()
Create a new Filter
Usage
Filter$new(...)
Arguments
...Named filter conditions
Method eq()
Add equality condition
Usage
Filter$eq(field, value)
Arguments
fieldField name
valueValue to match
Returns
Self for chaining
Method ne()
Add not-equal condition
Usage
Filter$ne(field, value)
Arguments
fieldField name
valueValue to exclude
Returns
Self for chaining
Method gt()
Add greater-than condition
Usage
Filter$gt(field, value)
Arguments
fieldField name
valueThreshold value
Returns
Self for chaining
Method lt()
Add less-than condition
Usage
Filter$lt(field, value)
Arguments
fieldField name
valueThreshold value
Returns
Self for chaining
Method in_list()
Add in-list condition
Usage
Filter$in_list(field, values)
Arguments
fieldField name
valuesVector of values
Returns
Self for chaining
Method to_list()
Convert to list for API
Usage
Filter$to_list()
Returns
List representation
Method clone()
The objects of this class are cloneable with this method.
Usage
Filter$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Global Search Result
Description
Result from global community search
Public fields
communitiesMatching communities
summariesCommunity summaries
contextCombined context
scoreRelevance score
Methods
Public methods
Method new()
Create new GlobalSearchResult
Usage
GlobalSearchResult$new( communities = list(), summaries = character(0), context = NULL, score = 0 )
Arguments
communitiesCommunities
summariesSummaries
contextContext
scoreScore
Method clone()
The objects of this class are cloneable with this method.
Usage
GlobalSearchResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Global Searcher
Description
Community-based graph search
Public fields
communitiesList of communities
kNumber of communities
Methods
Public methods
Method new()
Create a new GlobalSearcher
Usage
GlobalSearcher$new(communities, k = 5)
Arguments
communitiesList of Community objects
kNumber of communities
Method search()
Search communities
Usage
GlobalSearcher$search(query)
Arguments
queryQuery string
Returns
GlobalSearchResult
Method clone()
The objects of this class are cloneable with this method.
Usage
GlobalSearcher$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
GraphRAG Configuration
Description
Configuration for VectrixDB's GraphRAG implementation
Public fields
enabledWhether GraphRAG is enabled
chunk_sizeTarget tokens per chunk
chunk_overlapOverlapping tokens
chunk_by_sentencePreserve sentence boundaries
extractorExtraction method
nlp_modelNLP model name
llm_providerLLM provider
llm_modelModel name
llm_api_keyAPI key
llm_endpointCustom endpoint
llm_temperatureTemperature
llm_max_tokensMax tokens
max_community_levelsMax hierarchy depth
min_community_sizeMin entities per community
relationship_thresholdMin relationship strength
deduplicate_entitiesMerge similar entities
entity_similarity_thresholdSimilarity for dedup
search_typeDefault search strategy
local_search_kSeed entities for local search
global_search_kCommunities for global search
traversal_depthMax hops
include_relationshipsInclude relationship context
include_community_contextInclude community summaries
enable_incrementalIncremental updates
batch_sizeChunks per batch
use_cacheCache embeddings
cache_ttlCache TTL seconds
entity_typesTypes to extract
relationship_typesTypes to extract
Methods
Public methods
Method new()
Create a new GraphRAGConfig
Usage
GraphRAGConfig$new(enabled = FALSE, ...)
Arguments
enabledEnable GraphRAG
...Additional configuration options
Method with_openai()
Configure for OpenAI
Usage
GraphRAGConfig$with_openai(model = "gpt-4o-mini", api_key = NULL)
Arguments
modelModel name
api_keyAPI key
Returns
Self
Method with_ollama()
Configure for Ollama
Usage
GraphRAGConfig$with_ollama( model = "llama3.2", endpoint = "http://localhost:11434" )
Arguments
modelModel name
endpointEndpoint URL
Returns
Self
Method clone()
The objects of this class are cloneable with this method.
Usage
GraphRAGConfig$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
config <- GraphRAGConfig$new(enabled = TRUE)
db <- Vectrix$new("knowledge_base", graphrag_config = config)
## End(Not run)
GraphRAG Pipeline
Description
Complete GraphRAG processing pipeline
Public fields
configGraphRAGConfig
graphKnowledgeGraph
communitiesDetected communities
Methods
Public methods
Method new()
Create a new GraphRAGPipeline
Usage
GraphRAGPipeline$new(config = NULL)
Arguments
configGraphRAGConfig
Method process()
Process documents
Usage
GraphRAGPipeline$process(texts, document_ids = NULL)
Arguments
textsCharacter vector of documents
document_idsDocument IDs
Returns
Self
Method search()
Search the graph
Usage
GraphRAGPipeline$search(query, search_type = NULL)
Arguments
queryQuery string
search_type"local", "global", or "hybrid"
Returns
Search result
Method stats()
Get statistics
Usage
GraphRAGPipeline$stats()
Returns
Named list
Method clone()
The objects of this class are cloneable with this method.
Usage
GraphRAGPipeline$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Graph Search Types
Description
Graph Search Types
Usage
GraphSearchType
Format
An object of class list of length 3.
HNSW Index
Description
High-performance approximate nearest neighbor index
Public fields
dimensionVector dimension
metricDistance metric
n_treesNumber of trees (for Annoy)
search_kSearch parameter
Methods
Public methods
Method new()
Create a new HNSWIndex
Usage
HNSWIndex$new(dimension, metric = "angular", n_trees = 50, search_k = -1)
Arguments
dimensionVector dimension
metricDistance metric: "angular", "euclidean", "manhattan", "dot"
n_treesNumber of trees for index (higher = more accuracy)
search_kSearch parameter (higher = more accuracy, -1 = auto)
Method add_items()
Add items to the index
Usage
HNSWIndex$add_items(ids, vectors)
Arguments
idsCharacter vector of IDs
vectorsMatrix of vectors (rows = items)
Returns
Self
Method build()
Build the index (required before searching)
Usage
HNSWIndex$build()
Returns
Self
Method search()
Search for nearest neighbors
Usage
HNSWIndex$search(query, k = 10, include_distances = TRUE)
Arguments
queryQuery vector
kNumber of neighbors
include_distancesReturn distances
Returns
Data frame with id, distance columns
Method get_vector()
Get vector by ID
Usage
HNSWIndex$get_vector(id)
Arguments
idItem ID
Returns
Vector or NULL
Method get_ids()
Get all IDs
Usage
HNSWIndex$get_ids()
Returns
Character vector
Method size()
Get item count
Usage
HNSWIndex$size()
Returns
Integer
Method remove_items()
Remove items from index
Usage
HNSWIndex$remove_items(ids)
Arguments
idsIDs to remove
Returns
Self
Method clear()
Clear the index
Usage
HNSWIndex$clear()
Returns
Self
Method save()
Save index to file
Usage
HNSWIndex$save(path)
Arguments
pathFile path
Method load()
Load index from file
Usage
HNSWIndex$load(path)
Arguments
pathFile path
Returns
Self
Method clone()
The objects of this class are cloneable with this method.
Usage
HNSWIndex$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
# Create index
index <- HNSWIndex$new(dimension = 128, metric = "angular")
# Add vectors
index$add_items(ids = c("a", "b", "c"),
vectors = matrix(rnorm(384), nrow = 3))
# Search
results <- index$search(query = rnorm(128), k = 5)
## End(Not run)
In-Memory Storage
Description
Fast in-memory storage backend
Public fields
dataStorage data
Methods
Public methods
Method new()
Create new in-memory storage
Usage
InMemoryStorage$new()
Method set()
Store a value
Usage
InMemoryStorage$set(key, value)
Arguments
keyStorage key
valueValue to store
Method get()
Retrieve a value
Usage
InMemoryStorage$get(key)
Arguments
keyStorage key
Returns
Stored value or NULL
Method delete()
Delete a value
Usage
InMemoryStorage$delete(key)
Arguments
keyStorage key
Method exists()
Check if key exists
Usage
InMemoryStorage$exists(key)
Arguments
keyStorage key
Returns
Logical
Method keys()
List all keys
Usage
InMemoryStorage$keys()
Returns
Character vector of keys
Method clear()
Clear all data
Usage
InMemoryStorage$clear()
Method count()
Get count of stored items
Usage
InMemoryStorage$count()
Returns
Integer count
Method clone()
The objects of this class are cloneable with this method.
Usage
InMemoryStorage$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Keyword Analyzer
Description
Treats entire input as single token
Super class
VectrixDB::TextAnalyzer -> KeywordAnalyzer
Methods
Public methods
Inherited methods
Method analyze()
Analyze text as single keyword
Usage
KeywordAnalyzer$analyze(text)
Arguments
textInput text
Returns
Single-element character vector
Method clone()
The objects of this class are cloneable with this method.
Usage
KeywordAnalyzer$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Knowledge Graph
Description
Graph storage for entities and relationships
Public fields
nameGraph name
Methods
Public methods
Method new()
Create a new KnowledgeGraph
Usage
KnowledgeGraph$new(name = "default")
Arguments
nameGraph name
Method add_entity()
Add an entity
Usage
KnowledgeGraph$add_entity(entity)
Arguments
entityEntity object
Method add_relationship()
Add a relationship
Usage
KnowledgeGraph$add_relationship(relationship)
Arguments
relationshipRelationship object
Method get_entity()
Get entity by ID
Usage
KnowledgeGraph$get_entity(entity_id)
Arguments
entity_idEntity ID
Returns
Entity or NULL
Method get_all_entities()
Get all entities
Usage
KnowledgeGraph$get_all_entities()
Returns
List of Entity objects
Method get_all_relationships()
Get all relationships
Usage
KnowledgeGraph$get_all_relationships()
Returns
List of Relationship objects
Method get_neighbors()
Get neighbors of an entity
Usage
KnowledgeGraph$get_neighbors(entity_id, direction = "both")
Arguments
entity_idEntity ID
direction"out", "in", or "both"
Returns
List of Entity objects
Method traverse()
Traverse graph from seed entities
Usage
KnowledgeGraph$traverse(seed_ids, max_depth = 2)
Arguments
seed_idsStarting entity IDs
max_depthMaximum depth
Returns
SubGraph object
Method entity_count()
Get entity count
Usage
KnowledgeGraph$entity_count()
Returns
Integer
Method relationship_count()
Get relationship count
Usage
KnowledgeGraph$relationship_count()
Returns
Integer
Method search_entities()
Search entities by name
Usage
KnowledgeGraph$search_entities(query, limit = 10)
Arguments
queryQuery string
limitMax results
Returns
List of Entity objects
Method clone()
The objects of this class are cloneable with this method.
Usage
KnowledgeGraph$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
LLM Provider Types
Description
LLM Provider Types
Usage
LLMProvider
Format
An object of class list of length 4.
Late Interaction Embedder (Simplified ColBERT-style)
Description
Token-level embeddings for late interaction scoring
Public fields
dimensionToken embedding dimension
languageLanguage setting ("en" or "ml")
Methods
Public methods
Method new()
Create a new LateInteractionEmbedder
Usage
LateInteractionEmbedder$new(dimension = 64, language = "en")
Arguments
dimensionEmbedding dimension per token
languageLanguage behavior ("en" = ASCII-focused, "ml" = Unicode-aware)
Method embed()
Embed texts to token-level embeddings
Usage
LateInteractionEmbedder$embed(texts)
Arguments
textsCharacter vector of texts
Returns
List of matrices (each matrix is token embeddings for a document)
Method score()
Compute late interaction (MaxSim) score
Usage
LateInteractionEmbedder$score(query_embeddings, doc_embeddings)
Arguments
query_embeddingsQuery token embeddings matrix
doc_embeddingsDocument token embeddings matrix
Returns
Numeric score
Method clone()
The objects of this class are cloneable with this method.
Usage
LateInteractionEmbedder$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Local Search Result
Description
Result from local graph search
Public fields
entitiesMatching entities
relationshipsRelated relationships
subgraphTraversed subgraph
contextCombined context text
scoreRelevance score
Methods
Public methods
Method new()
Create new LocalSearchResult
Usage
LocalSearchResult$new( entities = list(), relationships = list(), subgraph = NULL, context = NULL, score = 0 )
Arguments
entitiesEntities
relationshipsRelationships
subgraphSubGraph
contextContext
scoreScore
Method clone()
The objects of this class are cloneable with this method.
Usage
LocalSearchResult$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Local Searcher
Description
Entity-based graph search
Public fields
graphKnowledge graph
kNumber of seed entities
traversal_depthMax hops
Methods
Public methods
Method new()
Create a new LocalSearcher
Usage
LocalSearcher$new(graph, k = 10, traversal_depth = 2)
Arguments
graphKnowledgeGraph
kSeed entities
traversal_depthMax depth
Method search()
Search the graph
Usage
LocalSearcher$search(query)
Arguments
queryQuery string
Returns
LocalSearchResult
Method clone()
The objects of this class are cloneable with this method.
Usage
LocalSearcher$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Maximal Marginal Relevance (MMR) Reranker
Description
Reranks for diversity using MMR algorithm
Public fields
lambdaBalance between relevance and diversity (0-1)
Methods
Public methods
Method new()
Create a new MMRReranker
Usage
MMRReranker$new(lambda = 0.7)
Arguments
lambdaRelevance vs diversity tradeoff (higher = more relevance)
Method rerank()
Rerank for diversity
Usage
MMRReranker$rerank(query_vector, doc_vectors, doc_ids, scores, limit = 10)
Arguments
query_vectorQuery embedding
doc_vectorsMatrix of document embeddings
doc_idsVector of document IDs
scoresOriginal relevance scores
limitNumber of results
Returns
Data frame with reranked results
Method clone()
The objects of this class are cloneable with this method.
Usage
MMRReranker$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Memory Cache
Description
In-memory LRU cache with TTL support
Ultra-low latency, limited by available RAM. Best for hot data, session data, frequently accessed vectors.
Super class
VectrixDB::BaseCache -> MemoryCache
Methods
Public methods
Inherited methods
Method new()
Create a new MemoryCache
Usage
MemoryCache$new(config = NULL)
Arguments
configCacheConfig object
Method get()
Get value from cache
Usage
MemoryCache$get(key)
Arguments
keyCache key
Returns
Value or NULL
Method set()
Set value in cache
Usage
MemoryCache$set(key, value, ttl = NULL)
Arguments
keyCache key
valueValue to cache
ttlTime to live
Method delete()
Delete key from cache
Usage
MemoryCache$delete(key)
Arguments
keyCache key
Returns
Logical success
Method exists()
Check if key exists
Usage
MemoryCache$exists(key)
Arguments
keyCache key
Returns
Logical
Method clear()
Clear cache
Usage
MemoryCache$clear()
Method size()
Get cache size
Usage
MemoryCache$size()
Returns
Integer
Method cleanup_expired()
Cleanup expired entries
Usage
MemoryCache$cleanup_expired()
Returns
Integer count removed
Method clone()
The objects of this class are cloneable with this method.
Usage
MemoryCache$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
No-Op Cache
Description
Disabled cache (no caching)
Super class
VectrixDB::BaseCache -> NoCache
Methods
Public methods
Inherited methods
Method get()
Get value from cache (always returns NULL)
Usage
NoCache$get(key)
Arguments
keyCache key
Returns
NULL
Method set()
Set cache value (no-op)
Usage
NoCache$set(key, value, ttl = NULL)
Arguments
keyCache key
valueValue to cache
ttlTime-to-live in seconds (ignored)
Returns
Invisibly returns NULL
Method delete()
Delete key from cache (always FALSE)
Usage
NoCache$delete(key)
Arguments
keyCache key
Returns
FALSE
Method exists()
Check if key exists (always FALSE)
Usage
NoCache$exists(key)
Arguments
keyCache key
Returns
FALSE
Method clear()
Clear cache (no-op)
Usage
NoCache$clear()
Returns
Invisibly returns NULL
Method size()
Get cache size (always 0)
Usage
NoCache$size()
Returns
Integer zero
Method clone()
The objects of this class are cloneable with this method.
Usage
NoCache$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Regex Entity Extractor
Description
Simple regex-based entity extractor (no external dependencies)
Public fields
entity_typesEntity types to extract
Methods
Public methods
Method new()
Create a new RegexExtractor
Usage
RegexExtractor$new(entity_types = NULL)
Arguments
entity_typesTypes to extract
Method extract()
Extract entities from text
Usage
RegexExtractor$extract(text, chunk_id = NULL)
Arguments
textText to extract from
chunk_idChunk ID
Returns
ExtractionResult
Method clone()
The objects of this class are cloneable with this method.
Usage
RegexExtractor$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Relationship
Description
A relationship between entities
Public fields
idUnique identifier
source_idSource entity ID
target_idTarget entity ID
typeRelationship type
descriptionDescription
weightRelationship weight
source_chunksSource chunk IDs
metadataAdditional metadata
Methods
Public methods
Method new()
Create a new Relationship
Usage
Relationship$new( source_id, target_id, type, description = NULL, weight = 1, source_chunks = NULL, metadata = NULL )
Arguments
source_idSource entity
target_idTarget entity
typeRelationship type
descriptionDescription
weightWeight
source_chunksSources
metadataMetadata
Method to_list()
Convert to list
Usage
Relationship$to_list()
Method clone()
The objects of this class are cloneable with this method.
Usage
Relationship$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Reranker (Cross-Encoder Style Scoring)
Description
Reranks results using term overlap and semantic similarity
Public fields
languageLanguage setting ("en" or "ml")
Methods
Public methods
Method new()
Create a new RerankerEmbedder
Usage
RerankerEmbedder$new(language = "en")
Arguments
languageLanguage behavior ("en" = English stopwords, "ml" = Unicode tokens)
Method score()
Score query-document pairs
Usage
RerankerEmbedder$score(query, documents)
Arguments
queryQuery text
documentsCharacter vector of document texts
Returns
Numeric vector of scores (0-1)
Method clone()
The objects of this class are cloneable with this method.
Usage
RerankerEmbedder$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Single Search Result
Description
Represents a single search result with id, text, score, and metadata
Public fields
idDocument ID
textDocument text
scoreRelevance score
metadataDocument metadata
Methods
Public methods
Method new()
Create a new Result object
Usage
Result$new(id, text, score, metadata = list())
Arguments
idDocument ID
textDocument text
scoreRelevance score
metadataOptional metadata list
Method print()
Print result summary
Usage
Result$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
Result$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Search Results Collection
Description
Collection of search results with convenient accessors
Public fields
itemsList of Result objects
querySearch query
modeSearch mode
time_msExecution time in ms
Methods
Public methods
Method new()
Create a new Results object
Usage
Results$new(items = list(), query = "", mode = "hybrid", time_ms = 0)
Arguments
itemsList of Result objects
querySearch query string
modeSearch mode used
time_msExecution time in milliseconds
Method length()
Get number of results
Usage
Results$length()
Method texts()
Get all result texts
Usage
Results$texts()
Returns
Character vector of texts
Method ids()
Get all result IDs
Usage
Results$ids()
Returns
Character vector of IDs
Method scores()
Get all scores
Usage
Results$scores()
Returns
Numeric vector of scores
Method top()
Get top result
Usage
Results$top()
Returns
Result object or NULL if empty
Method get()
Get result by index
Usage
Results$get(i)
Arguments
iIndex
Returns
Result object
Method foreach()
Iterate over results
Usage
Results$foreach(fn)
Arguments
fnFunction to apply to each result
Method print()
Print results summary
Usage
Results$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
Results$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
SQLite Storage
Description
Persistent SQLite storage backend
Public fields
db_pathDatabase file path
connDatabase connection
Methods
Public methods
Method new()
Create new SQLite storage
Usage
SQLiteStorage$new(path)
Arguments
pathDatabase file path
Method set()
Store a value
Usage
SQLiteStorage$set(key, value)
Arguments
keyStorage key
valueValue to store
Method get()
Retrieve a value
Usage
SQLiteStorage$get(key)
Arguments
keyStorage key
Returns
Stored value or NULL
Method delete()
Delete a value
Usage
SQLiteStorage$delete(key)
Arguments
keyStorage key
Method exists()
Check if key exists
Usage
SQLiteStorage$exists(key)
Arguments
keyStorage key
Returns
Logical
Method keys()
List all keys
Usage
SQLiteStorage$keys()
Returns
Character vector of keys
Method clear()
Clear all data
Usage
SQLiteStorage$clear()
Method count()
Get count of stored items
Usage
SQLiteStorage$count()
Returns
Integer count
Method close()
Close database connection
Usage
SQLiteStorage$close()
Method clone()
The objects of this class are cloneable with this method.
Usage
SQLiteStorage$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Search Mode Enumeration
Description
Available search modes for VectrixDB
Usage
SearchMode
Format
An object of class list of length 5.
Sentence Embedder using Word Vectors
Description
Creates sentence embeddings by averaging word vectors with IDF weighting
Public fields
dimEmbedding dimension
vocab_sizeVocabulary size
Methods
Public methods
Method new()
Create a new SentenceEmbedder
Usage
SentenceEmbedder$new(word_vectors, use_idf = TRUE, smooth_idf = 1)
Arguments
word_vectorsWordVectors object from load_word_vectors()
use_idfUse IDF weighting (recommended)
smooth_idfSmoothing for IDF
Method fit()
Fit IDF weights on a corpus
Usage
SentenceEmbedder$fit(texts)
Arguments
textsCharacter vector of texts
Method embed()
Embed texts to sentence vectors
Usage
SentenceEmbedder$embed(texts)
Arguments
textsCharacter vector of texts
Returns
Matrix of embeddings (rows are sentences)
Method get_word_vector()
Get word vector for a single word
Usage
SentenceEmbedder$get_word_vector(word)
Arguments
wordWord to look up
Returns
Numeric vector or NULL if not found
Method has_word()
Check if word is in vocabulary
Usage
SentenceEmbedder$has_word(word)
Arguments
wordWord to check
Returns
Logical
Method most_similar()
Find most similar words
Usage
SentenceEmbedder$most_similar(word, n = 10)
Arguments
wordQuery word
nNumber of results
Returns
Data frame with word and similarity
Method clone()
The objects of this class are cloneable with this method.
Usage
SentenceEmbedder$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Simple Stemmer
Description
Simple suffix-stripping stemmer (no external dependencies)
Public fields
suffixesList of suffixes to remove
Methods
Public methods
Method stem()
Stem a word
Usage
SimpleStemmer$stem(word)
Arguments
wordWord to stem
Returns
Stemmed word
Method stem_words()
Stem multiple words
Usage
SimpleStemmer$stem_words(words)
Arguments
wordsCharacter vector
Returns
Stemmed words
Method clone()
The objects of this class are cloneable with this method.
Usage
SimpleStemmer$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Sparse Embedder (BM25/TF-IDF)
Description
Generates sparse BM25 embeddings for keyword search
Public fields
vocabVocabulary
languageLanguage setting ("en" or "ml")
Methods
Public methods
Method new()
Create a new SparseEmbedder
Usage
SparseEmbedder$new(language = "en")
Arguments
languageLanguage behavior ("en" = ASCII-focused, "ml" = Unicode-aware)
Method fit()
Fit the embedder on a corpus
Usage
SparseEmbedder$fit(texts)
Arguments
textsCharacter vector of texts
Method embed()
Embed texts to sparse vectors
Usage
SparseEmbedder$embed(texts)
Arguments
textsCharacter vector of texts
Returns
Sparse matrix of BM25 scores
Method query_terms()
Get term scores for a query
Usage
SparseEmbedder$query_terms(query)
Arguments
queryQuery text
Returns
Named vector of term scores
Method clone()
The objects of this class are cloneable with this method.
Usage
SparseEmbedder$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
SubGraph
Description
A subset of a knowledge graph
Public fields
entitiesEntities in subgraph
relationshipsRelationships in subgraph
Methods
Public methods
Method new()
Create a new SubGraph
Usage
SubGraph$new(entities = list(), relationships = list())
Arguments
entitiesEntities
relationshipsRelationships
Method to_list()
Convert to list
Usage
SubGraph$to_list()
Method clone()
The objects of this class are cloneable with this method.
Usage
SubGraph$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Text Analyzer
Description
Text analyzer for search indexing
Provides text processing pipelines:
Tokenization
Lowercasing
Stopword removal
Stemming
Synonym expansion
Public fields
lowercaseConvert to lowercase
remove_stopwordsRemove stopwords
stopwordsSet of stopwords
stemmerStemmer object
synonymsSynonym dictionary
min_token_lengthMinimum token length
max_token_lengthMaximum token length
token_patternRegex pattern for tokens
Methods
Public methods
Method new()
Create a new TextAnalyzer
Usage
TextAnalyzer$new( lowercase = TRUE, remove_stopwords = FALSE, stopwords = NULL, use_stemmer = FALSE, synonyms = NULL, min_token_length = 1, max_token_length = 100, token_pattern = "[a-zA-Z0-9]+" )
Arguments
lowercaseLowercase text (default: TRUE)
remove_stopwordsRemove stopwords (default: FALSE)
stopwordsCustom stopwords (default: ENGLISH_STOPWORDS)
use_stemmerUse stemming (default: FALSE)
synonymsNamed list of synonyms
min_token_lengthMin length (default: 1)
max_token_lengthMax length (default: 100)
token_patternRegex pattern
Method analyze()
Analyze text and return tokens
Usage
TextAnalyzer$analyze(text)
Arguments
textInput text
Returns
Character vector of tokens
Method analyze_query()
Analyze a query string
Usage
TextAnalyzer$analyze_query(query)
Arguments
queryQuery text
Returns
Character vector of tokens
Method clone()
The objects of this class are cloneable with this method.
Usage
TextAnalyzer$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
analyzer <- TextAnalyzer$english()
tokens <- analyzer$analyze("The quick brown foxes are jumping")
# c("quick", "brown", "fox", "jump")
## End(Not run)
Text Unit
Description
A chunk of text from a document
Public fields
idUnique identifier
textText content
document_idSource document
chunk_indexIndex in document
start_charStart position
end_charEnd position
metadataAdditional metadata
Methods
Public methods
Method new()
Create a new TextUnit
Usage
TextUnit$new( id, text, document_id = NULL, chunk_index = 0, start_char = 0, end_char = 0, metadata = NULL )
Arguments
idUnique ID
textContent
document_idSource doc
chunk_indexIndex
start_charStart
end_charEnd
metadataMetadata
Method clone()
The objects of this class are cloneable with this method.
Usage
TextUnit$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Vector Cache
Description
Specialized cache for vector search results
Features:
Query result caching
Vector embedding caching
Automatic cache invalidation
Public fields
prefixCache key prefix
Methods
Public methods
Method new()
Create a new VectorCache
Usage
VectorCache$new(cache, prefix = "vec:")
Arguments
cacheBase cache backend
prefixKey prefix (default: "vec:")
Method get_search_results()
Get cached search results
Usage
VectorCache$get_search_results(collection, query, filter = NULL, limit = 10)
Arguments
collectionCollection name
queryQuery vector
filterFilter conditions
limitResult limit
Returns
Cached results or NULL
Method set_search_results()
Cache search results
Usage
VectorCache$set_search_results( collection, query, results, filter = NULL, limit = 10, ttl = 300 )
Arguments
collectionCollection name
queryQuery vector
resultsSearch results
filterFilter conditions
limitResult limit
ttlTime to live (default: 300)
Method get_vector()
Get cached vector
Usage
VectorCache$get_vector(collection, vector_id)
Arguments
collectionCollection name
vector_idVector ID
Returns
Cached vector data or NULL
Method set_vector()
Cache vector data
Usage
VectorCache$set_vector(collection, vector_id, data, ttl = 3600)
Arguments
collectionCollection name
vector_idVector ID
dataVector data
ttlTime to live (default: 3600)
Method invalidate_vector()
Invalidate cached vector
Usage
VectorCache$invalidate_vector(collection, vector_id)
Arguments
collectionCollection name
vector_idVector ID
Method stats()
Get cache statistics
Usage
VectorCache$stats()
Returns
CacheStats object
Method clone()
The objects of this class are cloneable with this method.
Usage
VectorCache$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
VectrixDB Easy API - The Simplest Vector Database
Description
Zero config. Text in, results out. One line for everything.
Public fields
nameCollection name
pathStorage path
dimensionVector dimension
model_nameModel identifier
model_typeModel type
languageLanguage setting
tierStorage tier
Methods
Public methods
Method new()
Create or open a VectrixDB collection
Usage
Vectrix$new( name = "default", path = NULL, model = NULL, dimension = NULL, embed_fn = NULL, model_path = NULL, language = NULL, tier = "dense", auto_download = TRUE )
Arguments
nameCollection name
pathStorage path. Defaults to a session temp directory.
modelEmbedding model: "tfidf" (default), "glove-50", "glove-100", "glove-200", "glove-300", or "word2vec"
dimensionVector dimension (auto-detected for GloVe)
embed_fnCustom embedding function: fn(texts) -> matrix
model_pathPath to pre-trained word vectors (GloVe .txt or word2vec .bin)
languageLanguage behavior: "en" (English-focused) or "ml" (multilingual/Unicode)
tierStorage tier: "dense", "hybrid", "ultimate", or "graph"
auto_downloadAutomatically download GloVe vectors if needed (default: TRUE)
Examples
\dontrun{
# Default TF-IDF embeddings (no external files needed)
db <- Vectrix$new("docs")
# With GloVe 100d word vectors (auto-downloads ~130MB)
db <- Vectrix$new("docs", model = "glove-100")
# With pre-downloaded GloVe
db <- Vectrix$new("docs", model_path = "path/to/glove.6B.100d.txt")
# Custom embedding function
db <- Vectrix$new("docs", embed_fn = my_embed_function, dimension = 768)
}
Method add()
Add texts to the collection
Usage
Vectrix$add(texts, metadata = NULL, ids = NULL)
Arguments
textsSingle text or character vector of texts
metadataOptional metadata list or list of lists
idsOptional custom IDs
Returns
Self for chaining
Examples
\dontrun{
db$add(c("text 1", "text 2"))
db$add("another text", metadata = list(source = "web"))
}
Method set_language()
Update collection language behavior
Usage
Vectrix$set_language(language = "en")
Arguments
languageLanguage behavior: "en" or "ml"
Returns
Self for chaining
Method search()
Search the collection
Usage
Vectrix$search( query, limit = 10, mode = "hybrid", rerank = NULL, filter = NULL, diversity = 0.7 )
Arguments
querySearch query text
limitNumber of results (default: 10)
modeSearch mode: "dense", "sparse", "hybrid", "ultimate"
rerankReranking method: NULL, "mmr", "exact", "cross-encoder"
filterMetadata filter
diversityDiversity parameter for MMR (0-1)
Returns
Results object with search results
Examples
\dontrun{
results <- db$search("python programming")
results <- db$search("AI", mode = "ultimate", rerank = "mmr")
print(results$top()$text)
}
Method delete()
Delete documents by ID
Usage
Vectrix$delete(ids)
Arguments
idsDocument ID(s) to delete
Returns
Self for chaining
Method clear()
Clear all documents from collection
Usage
Vectrix$clear()
Returns
Self for chaining
Method count()
Get number of documents
Usage
Vectrix$count()
Returns
Integer count
Method get()
Get documents by ID
Usage
Vectrix$get(ids)
Arguments
idsDocument ID(s)
Returns
List of Result objects
Method similar()
Find similar documents to a given document
Usage
Vectrix$similar(id, limit = 10)
Arguments
idDocument ID
limitNumber of results
Returns
Results object
Method close()
Close the database connection
Usage
Vectrix$close()
Method print()
Print Vectrix summary
Usage
Vectrix$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
Vectrix$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
# Create and add - ONE LINE
db <- Vectrix$new("my_docs")$add(c("Python is great", "Machine learning is fun"))
# Search - ONE LINE
results <- db$search("programming")
# Full power - STILL ONE LINE
results <- db$search("AI", mode = "ultimate") # dense + sparse + rerank
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$new`
## ------------------------------------------------
## Not run:
# Default TF-IDF embeddings (no external files needed)
db <- Vectrix$new("docs")
# With GloVe 100d word vectors (auto-downloads ~130MB)
db <- Vectrix$new("docs", model = "glove-100")
# With pre-downloaded GloVe
db <- Vectrix$new("docs", model_path = "path/to/glove.6B.100d.txt")
# Custom embedding function
db <- Vectrix$new("docs", embed_fn = my_embed_function, dimension = 768)
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$add`
## ------------------------------------------------
## Not run:
db$add(c("text 1", "text 2"))
db$add("another text", metadata = list(source = "web"))
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$search`
## ------------------------------------------------
## Not run:
results <- db$search("python programming")
results <- db$search("AI", mode = "ultimate", rerank = "mmr")
print(results$top()$text)
## End(Not run)
VectrixDB Database Class
Description
Main database interface managing collections
Usage
vectrixdb(path = NULL, storage_type = "memory")
Arguments
path |
Storage path |
storage_type |
Storage type |
Value
VectrixDB object
Public fields
pathDatabase storage path
Methods
Public methods
Method new()
Create or open a VectrixDB database
Usage
VectrixDB$new(path = NULL, storage_type = "memory")
Arguments
pathStorage path
storage_typeStorage type ("memory" or "sqlite")
Method create_collection()
Create a new collection
Usage
VectrixDB$create_collection( name, dimension, metric = "cosine", enable_text_index = TRUE )
Arguments
nameCollection name
dimensionVector dimension
metricDistance metric
enable_text_indexEnable text indexing
Returns
Collection object
Method get_collection()
Get an existing collection
Usage
VectrixDB$get_collection(name)
Arguments
nameCollection name
Returns
Collection object
Method list_collections()
List all collections
Usage
VectrixDB$list_collections()
Returns
Character vector of collection names
Method delete_collection()
Delete a collection
Usage
VectrixDB$delete_collection(name)
Arguments
nameCollection name
Method has_collection()
Check if collection exists
Usage
VectrixDB$has_collection(name)
Arguments
nameCollection name
Returns
Logical
Method stats()
Get database statistics
Usage
VectrixDB$stats()
Returns
List with stats
Method close()
Close the database
Usage
VectrixDB$close()
Method print()
Print database summary
Usage
VectrixDB$print()
Method clone()
The objects of this class are cloneable with this method.
Usage
VectrixDB$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Create ACL Config from List
Description
Create ACLConfig from list of ACL strings
Usage
acl_config_from_list(acl_list)
Arguments
acl_list |
Character vector of ACL strings |
Value
ACLConfig object
VectrixDB Advanced Search Features
Description
Enterprise-grade search capabilities:
Faceted search with aggregations
ACL/Security filtering
Text analyzers (stemming, synonyms, stopwords)
VectrixDB Cache Layer
Description
High-performance caching for low latency
Supports multiple cache backends:
InMemory LRU: Ultra-fast, limited by RAM
File-based: Persistent cache using RDS files
Create Cache Config from Environment
Description
Create config from environment variables
Usage
cache_config_from_env()
Value
CacheConfig object
Check if Python module is available
Description
Check if Python module is available
Usage
check_python_module(module)
Arguments
module |
Module name |
Value
Logical
VectrixDB Command Line Interface
Description
CLI tools for VectrixDB operations
Provides command-line style functions for:
Creating and managing collections
Adding and searching documents
Exporting and importing data
Database statistics and info
Print CLI Message
Description
Print CLI Message
Usage
cli_print(msg, type = "info")
Arguments
msg |
Message |
type |
Type: "info", "success", "warning", "error" |
Print Table
Description
Print Table
Usage
cli_table(df, max_rows = 20)
Arguments
df |
Data frame |
max_rows |
Max rows to show |
Compute cosine similarity
Description
Compute cosine similarity
Usage
cosine_similarity(query_vector, doc_vectors)
Arguments
query_vector |
Numeric vector (query) |
doc_vectors |
Matrix of document vectors |
Value
Numeric vector of similarities
Create Cache
Description
Factory function to create cache backend
Usage
create_cache(config = NULL)
Arguments
config |
CacheConfig object or NULL for defaults |
Value
Cache object
Create Default GraphRAG Config
Description
Create default config with regex extractor
Usage
create_default_graphrag_config(...)
Arguments
... |
Additional options |
Value
GraphRAGConfig object
Create HNSW Index
Description
Factory function to create HNSW index
Usage
create_hnsw_index(dimension, metric = "angular", n_trees = 50)
Arguments
dimension |
Vector dimension |
metric |
Distance metric |
n_trees |
Number of trees |
Value
HNSWIndex object
Create GraphRAG Pipeline
Description
Factory function for GraphRAGPipeline
Usage
create_pipeline(config = NULL)
Arguments
config |
GraphRAGConfig (optional) |
Value
GraphRAGPipeline object
Create a sentence embedder with automatic download
Description
Convenience function to create a SentenceEmbedder with GloVe vectors
Usage
create_sentence_embedder(model = "glove-100", use_idf = TRUE)
Arguments
model |
Model name (default: "glove-100") |
use_idf |
Use IDF weighting |
Value
SentenceEmbedder object
Examples
## Not run:
# Downloads GloVe if not present
embedder <- create_sentence_embedder("glove-100")
# Embed texts
vectors <- embedder$embed(c("Hello world", "Machine learning is cool"))
## End(Not run)
Create Vector Cache
Description
Create a VectorCache with specified backend
Usage
create_vector_cache(backend = "memory", ...)
Arguments
backend |
Backend type: "memory", "file", or "none" |
... |
Additional config options |
Value
VectorCache object
Download pre-trained word vectors
Description
Download GloVe or other pre-trained word vectors
Usage
download_vectors(model = "glove-50", dest_dir = NULL)
Arguments
model |
Model name: "glove-50", "glove-100", "glove-200", "glove-300" |
dest_dir |
Destination directory |
Value
Path to downloaded model
Download pre-trained word vectors
Description
Downloads GloVe or fastText word vectors
Usage
download_word_vectors(model = "glove-100", dest_dir = NULL, overwrite = FALSE)
Arguments
model |
Model to download: "glove-50", "glove-100", "glove-200", "glove-300", "glove-twitter-25", "glove-twitter-50", "glove-twitter-100", "glove-twitter-200" |
dest_dir |
Destination directory (default: user cache) |
overwrite |
Overwrite existing files |
Value
Path to the downloaded vectors file
Examples
## Not run:
# Download 100-dimensional GloVe vectors (~130MB)
path <- download_word_vectors("glove-100")
# Use with Vectrix
db <- Vectrix$new("docs", model = "glove", model_path = path)
## End(Not run)
VectrixDB Embedders (Pure R Implementation)
Description
Embedding models for text vectorization using R-native packages
Compute euclidean distance
Description
Compute euclidean distance
Usage
euclidean_distance(query_vector, doc_vectors)
Arguments
query_vector |
Numeric vector (query) |
doc_vectors |
Matrix of document vectors |
Value
Numeric vector of distances
Format time duration
Description
Format time duration
Usage
format_time(ms)
Arguments
ms |
Time in milliseconds |
Value
Formatted string
Generate deterministic ID from text
Description
Generate deterministic ID from text
Usage
generate_id(text)
Arguments
text |
Character string to hash |
Value
Character string (12 character MD5 hash prefix)
Get CLI Config
Description
Get CLI Config
Usage
get_cli_config()
Value
CLIConfig object
VectrixDB GraphRAG Module
Description
Native GraphRAG implementation for VectrixDB
Features:
Entity and relationship extraction
Hierarchical community detection
Local, global, and hybrid search strategies
Incremental graph updates
VectrixDB HNSW Index
Description
Hierarchical Navigable Small World graph for fast approximate nearest neighbor search
Uses RcppAnnoy for high-performance ANN search. Falls back to brute-force search if RcppAnnoy is not available.
Load GloVe text format
Description
Load GloVe text format
Usage
load_glove_text(path, max_words = NULL, normalize = TRUE)
Load HNSW Index
Description
Load saved index from file
Usage
load_hnsw_index(path)
Arguments
path |
File path |
Value
HNSWIndex object
Load word2vec binary format
Description
Load word2vec binary format
Usage
load_word2vec_binary(path, max_words = NULL, normalize = TRUE)
Load word vectors into memory
Description
Loads pre-trained word vectors from a file
Usage
load_word_vectors(path, max_words = NULL, normalize = TRUE)
Arguments
path |
Path to word vectors file (GloVe .txt or word2vec .bin) |
max_words |
Maximum number of words to load (NULL for all) |
normalize |
Normalize vectors to unit length |
Value
WordVectors object
Maximal Marginal Relevance (MMR) reranking
Description
Maximal Marginal Relevance (MMR) reranking
Usage
mmr_rerank(
query_vector,
doc_vectors,
doc_ids,
scores,
lambda = 0.7,
limit = 10
)
Arguments
query_vector |
Query embedding |
doc_vectors |
Matrix of document embeddings |
doc_ids |
Vector of document IDs |
scores |
Initial relevance scores |
lambda |
Diversity parameter (0-1) |
limit |
Number of results to return |
Value
Data frame with reranked results
Normalize language tag to supported values
Description
Normalize language tag to supported values
Usage
normalize_language_tag(language = NULL, default = "en")
Arguments
language |
Language label ("en", "english", "ml", "multi", etc.) |
default |
Default language when input is missing/invalid |
Value
"en" or "ml"
Normalize vectors for cosine similarity
Description
Normalize vectors for cosine similarity
Usage
normalize_vectors(vectors)
Arguments
vectors |
Matrix of vectors (rows are vectors) |
Value
Normalized matrix
Parse ACL String
Description
Parse ACL string like 'user:alice' or 'group:engineering'
Usage
parse_acl(acl_string)
Arguments
acl_string |
ACL string |
Value
ACLPrincipal object
Quick search - Index texts and search immediately
Description
Quick search - Index texts and search immediately
Usage
quick_search(texts, query, limit = 5)
Arguments
texts |
Character vector of texts to index |
query |
Search query |
limit |
Number of results |
Value
Results object
Examples
## Not run:
results <- quick_search(
texts = c("Python is great", "Java is verbose", "Rust is fast"),
query = "programming language"
)
print(results$top()$text)
## End(Not run)
Load word2vec model via optional runtime namespace lookup
Description
Load word2vec model via optional runtime namespace lookup
Usage
read_word2vec_model(path, normalize = TRUE)
Arguments
path |
Path to .bin model |
normalize |
Whether to normalize embeddings (forwarded when supported) |
Value
word2vec model object
Advanced Reranking Module
Description
Learned weight reranking with BM25 + semantic fusion
Reciprocal Rank Fusion (RRF)
Description
Reciprocal Rank Fusion (RRF)
Usage
rrf_fusion(rankings, k = 60, weights = NULL)
Arguments
rankings |
List of ranked ID vectors |
k |
RRF constant (default 60) |
weights |
Optional weights for each ranking |
Value
Named vector of fused scores
VectrixDB Server Functions
Description
REST API and dashboard server for VectrixDB
Set CLI Config
Description
Set CLI Config
Usage
set_cli_config(config)
Arguments
config |
CLIConfig object |
VectrixDB Storage Classes
Description
Storage backends for VectrixDB
Create English Text Analyzer
Description
English analyzer with stemming and stopwords
Usage
text_analyzer_english()
Value
TextAnalyzer object
Create Keyword Text Analyzer
Description
No tokenization - treat input as single token
Usage
text_analyzer_keyword()
Value
TextAnalyzer object
Create Simple Text Analyzer
Description
Lowercase + letter-only tokenization
Usage
text_analyzer_simple()
Value
TextAnalyzer object
Create Standard Text Analyzer
Description
Lowercase + basic tokenization
Usage
text_analyzer_standard()
Value
TextAnalyzer object
Language-aware tokenizer used across embedders and keyword search
Description
Language-aware tokenizer used across embedders and keyword search
Usage
tokenize_text_by_language(text, language = "en", remove_stopwords = FALSE)
Arguments
text |
Input text |
language |
"en" or "ml" |
remove_stopwords |
Remove English stopwords when language is "en" |
Value
Character vector of tokens
VectrixDB Types and Classes
Description
Core data types for VectrixDB operations
VectrixDB Utility Functions
Description
VectrixDB Utility Functions
Add Documents
Description
Add documents to a collection
Usage
vdb_add(db, texts, metadata = NULL, ids = NULL)
Arguments
db |
Vectrix object or collection name |
texts |
Character vector of texts |
metadata |
Optional metadata |
ids |
Optional IDs |
Value
Vectrix object
Examples
## Not run:
vdb_add(db, c("Document 1", "Document 2"))
vdb_add("my_docs", c("Another doc"))
## End(Not run)
Batch Add from Directory
Description
Add all text files from a directory
Usage
vdb_add_dir(db, dir_path, pattern = "\\.txt$", recursive = TRUE)
Arguments
db |
Vectrix object or collection name |
dir_path |
Directory path |
pattern |
File pattern (default: "*.txt") |
recursive |
Search subdirectories |
Value
Vectrix object
Examples
## Not run:
vdb_add_dir(db, "./documents/")
## End(Not run)
Create Collection
Description
Create a new VectrixDB collection
Usage
vdb_create(name, model = "tfidf", dimension = NULL, data_dir = NULL)
Arguments
name |
Collection name |
model |
Embedding model |
dimension |
Vector dimension |
data_dir |
Data directory |
Value
Vectrix object
Examples
## Not run:
db <- vdb_create("my_docs")
## End(Not run)
Launch VectrixDB Dashboard
Description
Start the VectrixDB API server and mount the HTML dashboard at
/dashboard.
Usage
vdb_dashboard(
db = NULL,
data_path = NULL,
port = 7377,
host = "127.0.0.1",
launch.browser = TRUE,
api_key = NULL
)
Arguments
db |
Optional |
data_path |
Path to vector database directory. |
port |
Port number (default: |
host |
Host address (default: |
launch.browser |
Whether to open browser on start. |
api_key |
Optional API key for authenticated write operations. |
Value
Invisibly returns server object from vectrix_serve().
Launch Simple Dashboard
Description
Convenience wrapper around vdb_dashboard() using db$path.
Usage
vdb_dashboard_simple(db)
Arguments
db |
Vectrix object. |
Value
Invisibly returns server object from vdb_dashboard().
Delete Collection
Description
Delete a collection
Usage
vdb_delete(name, data_dir = NULL, confirm = TRUE)
Arguments
name |
Collection name |
data_dir |
Data directory |
confirm |
Require confirmation |
Value
Logical success
Examples
## Not run:
vdb_delete("my_docs")
## End(Not run)
Delete Documents
Description
Delete documents by ID
Usage
vdb_delete_docs(db, ids)
Arguments
db |
Vectrix object or collection name |
ids |
Document ID(s) |
Value
Vectrix object
Export Collection
Description
Export collection to JSON file
Usage
vdb_export(db, path)
Arguments
db |
Vectrix object or collection name |
path |
Output file path |
Value
Logical success
Examples
## Not run:
vdb_export(db, "backup.json")
## End(Not run)
Get Document
Description
Get document by ID
Usage
vdb_get(db, ids)
Arguments
db |
Vectrix object or collection name |
ids |
Document ID(s) |
Value
List of Result objects
Import from File
Description
Import documents from text file
Usage
vdb_import(db, path, separator = "\n")
Arguments
db |
Vectrix object or collection name |
path |
Input file path |
separator |
Line separator for documents |
Value
Vectrix object
Examples
## Not run:
vdb_import(db, "documents.txt")
## End(Not run)
Collection Info
Description
Get collection information
Usage
vdb_info(db)
Arguments
db |
Vectrix object or collection name |
Value
Named list of info
Examples
## Not run:
vdb_info(db)
vdb_info("my_docs")
## End(Not run)
Start Interactive CLI
Description
Start an interactive VectrixDB session
Usage
vdb_interactive(collection = NULL)
Arguments
collection |
Default collection name |
Examples
## Not run:
vdb_interactive()
## End(Not run)
List Collections
Description
List all VectrixDB collections in the data directory
Usage
vdb_list(data_dir = NULL)
Arguments
data_dir |
Data directory path |
Value
Character vector of collection names
Examples
## Not run:
vdb_list()
## End(Not run)
Open Collection
Description
Open an existing collection
Usage
vdb_open(name, data_dir = NULL)
Arguments
name |
Collection name |
data_dir |
Data directory |
Value
Vectrix object
Examples
## Not run:
db <- vdb_open("my_docs")
## End(Not run)
Search Collection
Description
Search a collection
Usage
vdb_search(db, query, limit = 10, mode = "hybrid", show = TRUE)
Arguments
db |
Vectrix object or collection name |
query |
Search query |
limit |
Number of results |
mode |
Search mode: "dense", "sparse", "hybrid", "ultimate" |
show |
Print results |
Value
Results object
Examples
## Not run:
results <- vdb_search(db, "machine learning")
results <- vdb_search("my_docs", "AI", limit = 5)
## End(Not run)
Collection Statistics
Description
Get detailed statistics
Usage
vdb_stats(db)
Arguments
db |
Vectrix object or collection name |
Value
Named list of stats
Create a new Vectrix collection
Description
Create a new Vectrix collection
Usage
vectrix_create(name = "default", ...)
Arguments
name |
Collection name |
... |
Additional arguments passed to Vectrix$new() |
Value
Vectrix object
Display VectrixDB information
Description
Show database statistics and info
Usage
vectrix_info(path = NULL)
Arguments
path |
Database path |
Examples
## Not run:
vectrix_info(file.path(tempdir(), "my_data"))
## End(Not run)
Open an existing Vectrix collection
Description
Open an existing Vectrix collection
Usage
vectrix_open(name = "default", path = NULL)
Arguments
name |
Collection name |
path |
Storage path |
Value
Vectrix object
Start VectrixDB server
Description
Launch a REST API server with optional dashboard
Usage
vectrix_serve(
path = NULL,
host = "127.0.0.1",
port = 7377,
api_key = NULL,
dashboard = TRUE,
launch.browser = FALSE
)
Arguments
path |
Database path |
host |
Host address (default: "127.0.0.1") |
port |
Port number (default: 7377) |
api_key |
Optional API key for authentication |
dashboard |
Enable dashboard (default: TRUE) |
launch.browser |
Open dashboard/docs URL in browser (default: FALSE) |
Value
Invisible NULL (server runs until stopped)
Examples
## Not run:
vectrix_serve(path = file.path(tempdir(), "my_data"), port = 7377)
## End(Not run)
Check whether word2vec package is installed
Description
Check whether word2vec package is installed
Usage
word2vec_available()
Value
Logical
Word Vector Management
Description
Download, load, and use pre-trained word vectors (GloVe, fastText)