Skip to content

OpticsSearchLog

A search log row records a single knowledge-base question: what was asked, whether it was answered or abstained on, and how the engine performed.

The knowledge-base engine deliberately abstains when retrieval quality falls below the strictness floor. Logging every query — with its outcome, result count, top relevance score and latency — lets staff see how often that happens and tune the threshold. It also gives a record of what clients are actually asking.

Written by the search service, read only for observation.

  • app/Services/Optics/KnowledgeSearchService.php — writes one row per query.
  • app/Filament/Resources/OpticsSearchLogResource.php — staff browse and filter the log.
Relation Type Related model
organization belongsTo Organization
user belongsTo User

Table: optics_search_logs.

Column Type Notes
id uuid Primary key
organization_id uuid Nullable FK to organizations, null on delete
user_id uuid Nullable FK to users, null on delete
query text The question as asked
outcome string answered, abstained or error
source string Nullable: voice, agent or filament
result_count unsigned int Cast to integer, defaults to 0
top_score float Nullable; best relevance score
latency_ms unsigned int Nullable, cast to integer
created_at, updated_at timestamp

organization_id, outcome and created_at carry a composite index for the admin filters.