Package com.redis.vl.schema
Class BaseField
java.lang.Object
com.redis.vl.schema.BaseField
- Direct Known Subclasses:
GeoField,NumericField,TagField,TextField,VectorField
Base class for all field types in RedisVL. Provides common functionality for all field
implementations.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected final voidfinalize()Empty finalizer to prevent finalizer attacks on subclasses.abstract FieldTypeGet the field type.inthashCode()redis.clients.jedis.search.FieldNameConvert to Jedis FieldName for query building.abstract redis.clients.jedis.search.schemafields.SchemaFieldConvert to Jedis SchemaField for index creation.toJson()Serialize this field to JSON.toString()
-
Field Details
-
name
The name of the field in Redis -
alias
Optional alias for the field -
indexed
protected final boolean indexedWhether this field should be indexed -
sortable
protected final boolean sortableWhether this field is sortable
-
-
Constructor Details
-
BaseField
Create a field with just a name (defaults: indexed=true, sortable=false).- Parameters:
name- The name of the field in Redis
-
BaseField
Create a field with all properties.- Parameters:
name- The name of the field in Redisalias- Optional alias for the fieldindexed- Whether this field should be indexedsortable- Whether this field is sortable
-
-
Method Details
-
getFieldType
Get the field type.- Returns:
- The field type enumeration
-
toJedisSchemaField
public abstract redis.clients.jedis.search.schemafields.SchemaField toJedisSchemaField()Convert to Jedis SchemaField for index creation.- Returns:
- The Jedis schema field representation
-
toJedisFieldName
public redis.clients.jedis.search.FieldName toJedisFieldName()Convert to Jedis FieldName for query building.- Returns:
- The Jedis field name representation
-
toJson
Serialize this field to JSON.- Returns:
- JSON string representation of this field
-
toString
-
equals
-
hashCode
public int hashCode() -
finalize
protected final void finalize()Empty finalizer to prevent finalizer attacks on subclasses.Per SEI CERT OBJ11-J, classes that throw exceptions in constructors should have an empty final finalizer to prevent finalizer attacks through subclassing.
Note: finalize() is deprecated but required here for security (prevent finalizer attacks).
-