Package com.tnsai.session.extraction
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for KnowledgeFilter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault limit for search results. -
Constructor Summary
ConstructorsConstructorDescriptionKnowledgeFilter(Set<ExtractionType> types, double minConfidence, Set<String> tags, boolean matchAnyTag, String projectPath, String sessionId, Instant after, Instant before, int limit) Creates an instance of aKnowledgeFilterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionafter()Returns the value of theafterrecord component.static KnowledgeFilterall()Creates a filter that accepts all knowledge.before()Returns the value of thebeforerecord component.static KnowledgeFilter.Builderbuilder()Creates a builder.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if this filter has any tag restrictions.booleanChecks if this filter has any time restrictions.booleanChecks if this filter has any type restrictions.intlimit()Returns the value of thelimitrecord component.booleanReturns the value of thematchAnyTagrecord component.booleanmatches(ExtractedKnowledge knowledge) Tests if knowledge matches this filter.doubleReturns the value of theminConfidencerecord component.static KnowledgeFilterofTypes(ExtractionType... types) Creates a filter for specific types.Returns the value of theprojectPathrecord component.Returns the value of thesessionIdrecord component.tags()Returns the value of thetagsrecord component.final StringtoString()Returns a string representation of this record class.types()Returns the value of thetypesrecord component.static KnowledgeFilterwithMinConfidence(double minConfidence) Creates a filter with minimum confidence.
-
Field Details
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMITDefault 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 aKnowledgeFilterrecord class.- Parameters:
types- the value for thetypesrecord componentminConfidence- the value for theminConfidencerecord componenttags- the value for thetagsrecord componentmatchAnyTag- the value for thematchAnyTagrecord componentprojectPath- the value for theprojectPathrecord componentsessionId- the value for thesessionIdrecord componentafter- the value for theafterrecord componentbefore- the value for thebeforerecord componentlimit- the value for thelimitrecord component
-
-
Method Details
-
all
Creates a filter that accepts all knowledge. -
ofTypes
Creates a filter for specific types. -
withMinConfidence
Creates a filter with minimum confidence. -
builder
Creates a builder. -
matches
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
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 '=='. -
types
Returns the value of thetypesrecord component.- Returns:
- the value of the
typesrecord component
-
minConfidence
public double minConfidence()Returns the value of theminConfidencerecord component.- Returns:
- the value of the
minConfidencerecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
matchAnyTag
public boolean matchAnyTag()Returns the value of thematchAnyTagrecord component.- Returns:
- the value of the
matchAnyTagrecord component
-
projectPath
Returns the value of theprojectPathrecord component.- Returns:
- the value of the
projectPathrecord component
-
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
after
Returns the value of theafterrecord component.- Returns:
- the value of the
afterrecord component
-
before
Returns the value of thebeforerecord component.- Returns:
- the value of the
beforerecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-