Package com.tnsai.session
Record Class SessionQuery
java.lang.Object
java.lang.Record
com.tnsai.session.SessionQuery
public record SessionQuery(String text, String agentName, String projectPath, List<String> tags, SessionOutcome outcome, LocalDate startDate, LocalDate endDate, int limit, int offset, boolean caseSensitive, SessionQuery.SearchMode searchMode)
extends Record
Query builder for searching sessions.
Usage
SessionQuery query = SessionQuery.builder()
.text("authentication bug")
.agent("code-assistant")
.project("/my/project")
.tags("security", "urgent")
.outcome(SessionOutcome.SUCCESS)
.dateRange(LocalDate.now().minusDays(7), LocalDate.now())
.limit(20)
.build();
List<SessionSearchResult> results = searchable.search(query);
- Author:
- TnsAI Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for SessionQuery.static enumSearch mode for text queries. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault limit for search results. -
Constructor Summary
ConstructorsConstructorDescriptionSessionQuery(String text, String agentName, String projectPath, List<String> tags, SessionOutcome outcome, LocalDate startDate, LocalDate endDate, int limit, int offset, boolean caseSensitive, SessionQuery.SearchMode searchMode) Creates an instance of aSessionQueryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagentNamerecord component.static SessionQuery.Builderbuilder()Creates a builder.booleanReturns the value of thecaseSensitiverecord component.endDate()Returns the value of theendDaterecord component.final booleanIndicates whether some other object is "equal to" this one.booleanChecks if this query has any filters.final inthashCode()Returns a hash code value for this object.booleanChecks if this query has a text filter.intlimit()Returns the value of thelimitrecord component.intoffset()Returns the value of theoffsetrecord component.outcome()Returns the value of theoutcomerecord component.Returns the value of theprojectPathrecord component.static SessionQueryrecent(int limit) Creates a query for recent sessions.Returns the value of thesearchModerecord component.Returns the value of thestartDaterecord component.tags()Returns the value of thetagsrecord component.text()Returns the value of thetextrecord component.static SessionQueryCreates a simple text query.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMITDefault limit for search results.- See Also:
-
-
Constructor Details
-
SessionQuery
public SessionQuery(String text, String agentName, String projectPath, List<String> tags, SessionOutcome outcome, LocalDate startDate, LocalDate endDate, int limit, int offset, boolean caseSensitive, SessionQuery.SearchMode searchMode) Creates an instance of aSessionQueryrecord class.- Parameters:
text- the value for thetextrecord componentagentName- the value for theagentNamerecord componentprojectPath- the value for theprojectPathrecord componenttags- the value for thetagsrecord componentoutcome- the value for theoutcomerecord componentstartDate- the value for thestartDaterecord componentendDate- the value for theendDaterecord componentlimit- the value for thelimitrecord componentoffset- the value for theoffsetrecord componentcaseSensitive- the value for thecaseSensitiverecord componentsearchMode- the value for thesearchModerecord component
-
-
Method Details
-
builder
Creates a builder. -
text
Creates a simple text query. -
recent
Creates a query for recent sessions. -
hasTextFilter
public boolean hasTextFilter()Checks if this query has a text filter. -
hasFilters
public boolean hasFilters()Checks if this query has any filters. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
agentName
Returns the value of theagentNamerecord component.- Returns:
- the value of the
agentNamerecord component
-
projectPath
Returns the value of theprojectPathrecord component.- Returns:
- the value of the
projectPathrecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
outcome
Returns the value of theoutcomerecord component.- Returns:
- the value of the
outcomerecord component
-
startDate
Returns the value of thestartDaterecord component.- Returns:
- the value of the
startDaterecord component
-
endDate
Returns the value of theendDaterecord component.- Returns:
- the value of the
endDaterecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-
offset
public int offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
caseSensitive
public boolean caseSensitive()Returns the value of thecaseSensitiverecord component.- Returns:
- the value of the
caseSensitiverecord component
-
searchMode
Returns the value of thesearchModerecord component.- Returns:
- the value of the
searchModerecord component
-