Package com.tnsai.session
Interface SearchableSessionStore
- All Superinterfaces:
SessionStore
- All Known Implementing Classes:
SearchableFileSessionStore
Extended session store with search capabilities.
Usage
SearchableSessionStore store = new SearchableFileSessionStore(".tnsai/history/");
// Simple text search
List<SessionSearchResult> results = store.search("authentication bug");
// Advanced search with query builder
SessionQuery query = SessionQuery.builder()
.text("authentication")
.agent("code-assistant")
.outcome(SessionOutcome.SUCCESS)
.lastDays(7)
.limit(10)
.build();
List<SessionSearchResult> results = store.search(query);
- Author:
- TnsAI Team
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordSession statistics. -
Method Summary
Modifier and TypeMethodDescriptionstatic SearchableSessionStoreCreates a searchable file-based session store.findByToolUsage(String toolName) Searches for sessions containing a specific tool call.findSimilar(String sessionId, int limit) Gets sessions similar to the given session.getStats()Gets statistics about sessions.search(SessionQuery query) Searches sessions with a query.default List<SessionSearchResult> Searches sessions with a simple text query.Methods inherited from interface com.tnsai.session.SessionStore
clear, count, delete, exists, findByAgent, findByDate, findByDateRange, findByOutcome, findByProject, findByTag, findRecent, listSessionIds, load, save
-
Method Details
-
file
Creates a searchable file-based session store.- Parameters:
basePath- the base directory path- Returns:
- searchable session store
-
search
Searches sessions with a simple text query.- Parameters:
text- the text to search for- Returns:
- list of search results, sorted by relevance
-
search
Searches sessions with a query.- Parameters:
query- the search query- Returns:
- list of search results, sorted by relevance
-
findSimilar
Gets sessions similar to the given session.- Parameters:
sessionId- the session to find similar sessions forlimit- maximum results- Returns:
- list of similar sessions
-
findByToolUsage
Searches for sessions containing a specific tool call.- Parameters:
toolName- the tool name- Returns:
- list of matching sessions
-
getStats
SearchableSessionStore.SessionStats getStats()Gets statistics about sessions.- Returns:
- session statistics
-