Record Class KnowledgeFilter

java.lang.Object
java.lang.Record
com.tnsai.session.extraction.KnowledgeFilter

public record KnowledgeFilter(Set<ExtractionType> types, double minConfidence, Set<String> tags, boolean matchAnyTag, String projectPath, String sessionId, Instant after, Instant before, int limit) extends Record
Filter for searching extracted knowledge.

Usage


 KnowledgeFilter filter = KnowledgeFilter.builder()
     .types(ExtractionType.SOLUTION, ExtractionType.PATTERN)
     .minConfidence(0.8)
     .tags("security", "authentication")
     .build();

 List<ExtractedKnowledge> results = knowledgeStore.search("auth", filter);
 
Author:
TnsAI Team
  • Field Details

    • DEFAULT_LIMIT

      public static final int DEFAULT_LIMIT
      Default limit for search results.
      See Also:
  • Constructor Details

    • KnowledgeFilter

      public KnowledgeFilter(Set<ExtractionType> types, double minConfidence, Set<String> tags, boolean matchAnyTag, String projectPath, String sessionId, Instant after, Instant before, int limit)
      Creates an instance of a KnowledgeFilter record class.
      Parameters:
      types - the value for the types record component
      minConfidence - the value for the minConfidence record component
      tags - the value for the tags record component
      matchAnyTag - the value for the matchAnyTag record component
      projectPath - the value for the projectPath record component
      sessionId - the value for the sessionId record component
      after - the value for the after record component
      before - the value for the before record component
      limit - the value for the limit record component
  • Method Details

    • all

      public static KnowledgeFilter all()
      Creates a filter that accepts all knowledge.
    • ofTypes

      public static KnowledgeFilter ofTypes(ExtractionType... types)
      Creates a filter for specific types.
    • withMinConfidence

      public static KnowledgeFilter withMinConfidence(double minConfidence)
      Creates a filter with minimum confidence.
    • builder

      public static KnowledgeFilter.Builder builder()
      Creates a builder.
    • matches

      public boolean matches(ExtractedKnowledge knowledge)
      Tests if knowledge matches this filter.
    • hasTypeFilter

      public boolean hasTypeFilter()
      Checks if this filter has any type restrictions.
    • hasTagFilter

      public boolean hasTagFilter()
      Checks if this filter has any tag restrictions.
    • hasTimeFilter

      public boolean hasTimeFilter()
      Checks if this filter has any time restrictions.
    • 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.
    • types

      public Set<ExtractionType> types()
      Returns the value of the types record component.
      Returns:
      the value of the types record component
    • minConfidence

      public double minConfidence()
      Returns the value of the minConfidence record component.
      Returns:
      the value of the minConfidence record component
    • tags

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

      public boolean matchAnyTag()
      Returns the value of the matchAnyTag record component.
      Returns:
      the value of the matchAnyTag record component
    • projectPath

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

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • after

      public Instant after()
      Returns the value of the after record component.
      Returns:
      the value of the after record component
    • before

      public Instant before()
      Returns the value of the before record component.
      Returns:
      the value of the before record component
    • limit

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