SourceService¶
Service for ingesting and managing source content.
Class: FactDb::Services::SourceService¶
Methods¶
create¶
Create new source with automatic deduplication.
Parameters:
content(String) - Source text contentkind(Symbol) - Content kindcaptured_at(Time) - Capture timestampmetadata(Hash) - Additional metadatatitle(String) - Optional titlesource_uri(String) - Original location
Returns: Models::Source
Example:
source = service.create(
"Email body text...",
kind: :email,
title: "RE: Important",
metadata: { from: "sender@example.com" }
)
find¶
Find source by ID.
Returns: Models::Source
find_by_hash¶
Find source by SHA256 hash.
Returns: Models::Source or nil
Example:
search¶
Full-text search sources.
Parameters:
query(String) - Search querylimit(Integer) - Max results
Returns: Array<Models::Source>
Example:
semantic_search¶
Semantic similarity search using embeddings.
Parameters:
query(String) - Search querylimit(Integer) - Max results
Returns: Array<Models::Source>
Example:
by_kind¶
Filter sources by kind.
Returns: ActiveRecord::Relation
Example:
recent¶
Get recently captured sources.
Returns: Array<Models::Source>
mentioning_entity¶
Find sources that mention an entity (via facts).
Returns: Array<Models::Source>
Example: