PropertyFilter

sealed interface PropertyFilter

Filter expression for property-based filtering on key-value maps.

A safe, composable expression tree that can be used for:

  • Metadata filtering: Applied to metadata maps

  • Property filtering: Applied to object property maps or typed entity fields

  • Guard conditions: LLM-generatable expressions for safe condition evaluation

Backends can translate this to native query syntax (Lucene field queries, Cypher WHERE clauses, etc.) and fall back to InMemoryPropertyFilter for post-filtering when native filtering isn't available.

Limitation: Nested Properties Not Supported

Filters operate on top-level properties only. Nested property paths like "address.city" or "metadata.source" are not supported. The filter key must match a direct key in the target map or a top-level property on the target object.

Kotlin users can use operator syntax for combining filters:

val filter = (eq("owner", "alice") and gte("score", 0.8)) or eq("role", "admin")
val excluded = !eq("status", "deleted")

Inheritors

Types

Link copied to clipboard
data class And(val filters: List<PropertyFilter>) : PropertyFilter

Logical AND: all filters must match

Link copied to clipboard
object Companion
Link copied to clipboard
data class Contains(val key: String, val value: String) : PropertyFilter

Contains substring: propertieskey.toString().contains(value)

Link copied to clipboard
data class ContainsIgnoreCase(val key: String, val value: String) : PropertyFilter

Contains substring (case-insensitive): propertieskey.toString().lowercase().contains(value.lowercase())

Link copied to clipboard
data class EndsWith(val key: String, val value: String) : PropertyFilter

Ends with suffix: propertieskey.toString().endsWith(value)

Link copied to clipboard
data class Eq(val key: String, val value: Any) : PropertyFilter

Equals: propertieskey == value

Link copied to clipboard
data class EqIgnoreCase(val key: String, val value: String) : PropertyFilter

Equals (case-insensitive): propertieskey.toString().lowercase() == value.lowercase()

Link copied to clipboard
data class Gt(val key: String, val value: Number) : PropertyFilter

Greater than: propertieskey value

Link copied to clipboard
data class Gte(val key: String, val value: Number) : PropertyFilter

Greater than or equal: propertieskey>= value

Link copied to clipboard
data class In(val key: String, val values: List<Any>) : PropertyFilter

In list: propertieskey in values

Link copied to clipboard
data class Like(val key: String, val pattern: String) : PropertyFilter

Regex pattern match: propertieskey.toString().matches(Regex(pattern))

Link copied to clipboard
data class Lt(val key: String, val value: Number) : PropertyFilter

Less than: propertieskey< value

Link copied to clipboard
data class Lte(val key: String, val value: Number) : PropertyFilter

Less than or equal: propertieskey<= value

Link copied to clipboard
data class Ne(val key: String, val value: Any) : PropertyFilter

Not equals: propertieskey != value

Link copied to clipboard
data class Nin(val key: String, val values: List<Any>) : PropertyFilter

Not in list: propertieskey not in values

Link copied to clipboard
data class Not(val filter: PropertyFilter) : PropertyFilter

Logical NOT: filter must not match

Link copied to clipboard
data class Or(val filters: List<PropertyFilter>) : PropertyFilter

Logical OR: at least one filter must match

Link copied to clipboard
data class StartsWith(val key: String, val value: String) : PropertyFilter

Starts with prefix: propertieskey.toString().startsWith(value)

Functions

Link copied to clipboard
open infix fun and(other: PropertyFilter): PropertyFilter

Logical AND infix: filter1 and filter2

Link copied to clipboard
open operator fun not(): PropertyFilter

Logical NOT operator: !filter

Link copied to clipboard
open infix fun or(other: PropertyFilter): PropertyFilter

Logical OR infix: filter1 or filter2