VectorMetadata
Object Hierarchy:
Description:
public class VectorMetadata : Object
Represents vector metadata stored in SQL database.
Maps vector_id (from FAISS) to code location information. This class provides the link between vector embeddings in FAISS and actual code
locations in source files. Used by both the indexing pipeline (to store metadata) and search operations (to retrieve code snippets).
The class uses SQ.Query for database operations and provides methods for querying metadata by file_id, element_type, and other filters.
Usage Example
// Initialize database schema
VectorMetadata.initDB(sql_db);
// Create metadata entry
var metadata = new VectorMetadata() {
vector_id = 123,
file_id = file.id,
start_line = 10,
end_line = 25,
element_type = "method",
element_name = "process_data"
};
metadata.insert(sql_db);
// Query metadata
var query = VectorMetadata.query(sql_db);
var results = query.select("SELECT * FROM vector_metadata WHERE file_id = $file_id");
Content:
Properties:
- public string @namespace { get; set; }
Namespace that contains this element (e.g., "OLLMvector.Indexing").
Not stored in database - used for analysis only.
- public string ast_path { get; set; }
AST path representing the hierarchical location of the element.
Format: namespace-class-method or namespace-function etc. (using '-' separator). Empty string for file elements (files don't have AST
paths). Stored in database for search and navigation.
- public string category { get; set; }
Document category (for documentation files only).
- public ArrayList<VectorMetadata> children { get; }
Child sections (for documentation files only).
- public int codedoc_end { get; set; }
Ending line number of documentation block (1-indexed, optional). Not
stored in database - used for analysis only. Use -1 to indicate no documentation.
- public int codedoc_start { get; set; }
Starting line number of documentation block (1-indexed, optional). Not
stored in database - used for analysis only. Use -1 to indicate no documentation.
- public string description { get; set; }
One-line description generated by LLM analysis. Stored in database for
future rebuild operations. Empty string if LLM analysis was skipped (e.g., for simple properties, enum types without docs).
- public string element_name { get; set; }
Element name (e.g., "DatabaseManager", "execute_query", etc.).
- public string element_type { get; set; }
Element type (e.g., "class", "method", "function", "property", etc.).
- public int end_line { get; set; }
Ending line number (1-indexed).
- public int64 file_id { get; set; }
File ID (references OLLMfiles.File.id).
- public int64 id { get; set; }
ID property for database operations (PRIMARY KEY, auto-increment).
Used by SQ.Query.updateById/deleteId for database operations. This is automatically generated by the database and should not be set
manually.
- public string md5_hash { get; set; }
MD5 hash of element's code content for change detection. Empty string
for legacy data (before MD5 support was added). Stored in database for incremental analysis.
- public VectorMetadata? parent { get; set; }
Parent VectorMetadata reference (for documentation section hierarchy).
- public string parent_class { get; set; }
Parent class/struct/interface that contains this element (e.g.,
"Tree"). Not stored in database - used for analysis only.
- public string signature { get; set; }
Element signature (e.g., "public async void parse() throws
GLib.Error"). Not stored in database - used for analysis only.
- public int start_line { get; set; }
Starting line number (1-indexed).
- public int64 vector_id { get; set; }
Vector ID from FAISS index. This is the actual property used
throughout the codebase for vector operations. This is separate from the database id and represents the FAISS vector index.
Static methods:
- public static async void cleanup_all_deleted (Database db)
Remove vector_metadata entries for all deleted files.
- public static HashSet<int64?> get_all_vector_ids (Database db)
Get all vector_ids from the metadata table.
- public static void initDB (Database db)
Initialize database table for vector_metadata objects.
- public static VectorMetadata? lookup (Database db, string key, int64 value)
Generic lookup method for vector metadata.
- public static ArrayList<VectorMetadata> lookup_path (Database db, int64[] file_ids, string ast_path)
Lookup AST path across multiple files (for codebase search).
- public static ArrayList<VectorMetadata> lookup_vectors (Database db, int64[] vector_ids)
Lookup metadata for multiple vector_ids (for search results).
- public static Query<VectorMetadata> query (Database db)
Create a query object for vector_metadata table.
- public static void reset_database (Database sql_db, string vector_db_path) throws Error
Resets the vector database.
Creation methods:
Methods:
Inherited Members:
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref