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
  • Field Details

    • DEFAULT_LIMIT

      public static final int DEFAULT_LIMIT
      Default 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 a SessionQuery record class.
      Parameters:
      text - the value for the text record component
      agentName - the value for the agentName record component
      projectPath - the value for the projectPath record component
      tags - the value for the tags record component
      outcome - the value for the outcome record component
      startDate - the value for the startDate record component
      endDate - the value for the endDate record component
      limit - the value for the limit record component
      offset - the value for the offset record component
      caseSensitive - the value for the caseSensitive record component
      searchMode - the value for the searchMode record component
  • Method Details

    • builder

      public static SessionQuery.Builder builder()
      Creates a builder.
    • text

      public static SessionQuery text(String text)
      Creates a simple text query.
    • recent

      public static SessionQuery recent(int limit)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • agentName

      public String agentName()
      Returns the value of the agentName record component.
      Returns:
      the value of the agentName record component
    • projectPath

      public String projectPath()
      Returns the value of the projectPath record component.
      Returns:
      the value of the projectPath record component
    • tags

      public List<String> tags()
      Returns the value of the tags record component.
      Returns:
      the value of the tags record component
    • outcome

      public SessionOutcome outcome()
      Returns the value of the outcome record component.
      Returns:
      the value of the outcome record component
    • startDate

      public LocalDate startDate()
      Returns the value of the startDate record component.
      Returns:
      the value of the startDate record component
    • endDate

      public LocalDate endDate()
      Returns the value of the endDate record component.
      Returns:
      the value of the endDate record component
    • limit

      public int limit()
      Returns the value of the limit record component.
      Returns:
      the value of the limit record component
    • offset

      public int offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • caseSensitive

      public boolean caseSensitive()
      Returns the value of the caseSensitive record component.
      Returns:
      the value of the caseSensitive record component
    • searchMode

      public SessionQuery.SearchMode searchMode()
      Returns the value of the searchMode record component.
      Returns:
      the value of the searchMode record component