Package dev.agenor.core.memory
Record Class MemoryQuery
java.lang.Object
java.lang.Record
dev.agenor.core.memory.MemoryQuery
- Record Components:
text- optional full-text or substring filter; null means no text constraintscope- memory scope to search (MemoryScope.SHORT_TERMorMemoryScope.LONG_TERM); must not be nullownerId- optional filter by owning agent ID; null means any ownerfilters- immutable map of metadata key/value filters; empty if nulllimit- maximum number of results to return; must be between 1 and 1000
public record MemoryQuery(String text, MemoryScope scope, String ownerId, Map<String,Object> filters, int limit)
extends Record
Query parameters for searching memory entries.
Example:
MemoryQuery query = MemoryQuery.builder()
.text("customer order")
.scope(MemoryScope.LONG_TERM)
.ownerId("order-agent")
.filter("status", "completed")
.limit(10)
.build();
List<MemoryEntry> results = memoryStore.search(query).join();
- Since:
- 0.6.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating MemoryQuery instances. -
Constructor Summary
ConstructorsConstructorDescriptionMemoryQuery(String text, MemoryScope scope, String ownerId, Map<String, Object> filters, int limit) Compact constructor with validation and defensive copying. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryQuery.Builderbuilder()Creates a new builder for constructing queries.final booleanIndicates whether some other object is "equal to" this one.filters()Returns the value of thefiltersrecord component.<T> TGets a specific filter value cast to the specified type.final inthashCode()Returns a hash code value for this object.booleanChecks if this query has metadata filters.booleanChecks if this query has an owner filter.booleanChecks if this query has a text filter.intlimit()Returns the value of thelimitrecord component.ownerId()Returns the value of theownerIdrecord component.scope()Returns the value of thescoperecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
hasTextFilter
public boolean hasTextFilter()Checks if this query has a text filter.- Returns:
- true if text search is specified
-
hasOwnerFilter
public boolean hasOwnerFilter()Checks if this query has an owner filter.- Returns:
- true if owner ID is specified
-
hasMetadataFilters
public boolean hasMetadataFilters()Checks if this query has metadata filters.- Returns:
- true if any filters are specified
-
getFilter
Gets a specific filter value cast to the specified type.- Type Parameters:
T- the type parameter- Parameters:
key- the filter keytype- the expected type- Returns:
- the filter value, or null if not found
- Throws:
ClassCastException- if the value cannot be cast to the specified type
-
builder
Creates a new builder for constructing queries.- Returns:
- a new builder instance
-
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
-
scope
Returns the value of thescoperecord component.- Returns:
- the value of the
scoperecord component
-
ownerId
Returns the value of theownerIdrecord component.- Returns:
- the value of the
ownerIdrecord component
-
filters
Returns the value of thefiltersrecord component.- Returns:
- the value of the
filtersrecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-