Package com.google.gerrit.index
Class IndexedField.SearchSpec
java.lang.Object
com.google.gerrit.index.IndexedField.SearchSpec
- All Implemented Interfaces:
SchemaFieldDefs.SchemaField<I,
T>
- Enclosing class:
- IndexedField<I,
T>
Defines how
IndexedField
can be searched and how the index tokens are generated.
Multiple IndexedField<I,
can be defined on a single IndexedField
.
Depending on the implementation, indexes can choose to store IndexedField
and IndexedField<I,
separately. The searches are issues to IndexedField<I,
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the field contents from the input object.getField()
ReturnsIndexedField
on which this spec was created.getName()
Returns the name of the field.ReturnsSearchOption
enabled on this field.FieldType<?>
getType()
Returns type of the field; for repeatable fields, the inner type, not the iterable type.boolean
Returns whether the field is repeatable.boolean
isStored()
Returns whether the field should be stored in the index.boolean
setIfPossible
(I object, StoredValue doc) Set the field contents back to an object.
-
Constructor Details
-
SearchSpec
-
-
Method Details
-
isStored
public boolean isStored()Description copied from interface:SchemaFieldDefs.SchemaField
Returns whether the field should be stored in the index.- Specified by:
isStored
in interfaceSchemaFieldDefs.SchemaField<I,
T>
-
isRepeatable
public boolean isRepeatable()Description copied from interface:SchemaFieldDefs.SchemaField
Returns whether the field is repeatable.- Specified by:
isRepeatable
in interfaceSchemaFieldDefs.SchemaField<I,
T>
-
get
Description copied from interface:SchemaFieldDefs.SchemaField
Get the field contents from the input object.- Specified by:
get
in interfaceSchemaFieldDefs.SchemaField<I,
T> - Parameters:
obj
- input object.- Returns:
- the field value(s) to index.
-
getName
Description copied from interface:SchemaFieldDefs.SchemaField
Returns the name of the field.- Specified by:
getName
in interfaceSchemaFieldDefs.SchemaField<I,
T>
-
getType
Description copied from interface:SchemaFieldDefs.SchemaField
Returns type of the field; for repeatable fields, the inner type, not the iterable type. TODO(mariasavtchuk): remove after migrating to the new field formats- Specified by:
getType
in interfaceSchemaFieldDefs.SchemaField<I,
T>
-
setIfPossible
Description copied from interface:SchemaFieldDefs.SchemaField
Set the field contents back to an object. Used to reconstruct fields from indexed values. No-op if the field can't be reconstructed.- Specified by:
setIfPossible
in interfaceSchemaFieldDefs.SchemaField<I,
T> - Parameters:
object
- input object.doc
- indexed document- Returns:
true
if the field was set,false
otherwise
-
getSearchOption
ReturnsSearchOption
enabled on this field.- Returns:
SearchOption
-
getField
ReturnsIndexedField
on which this spec was created.- Returns:
- original
IndexedField
of this spec.
-