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>
public class IndexedField.SearchSpec extends Object implements SchemaFieldDefs.SchemaField<I,T>
Defines howIndexedField
can be searched and how the index tokens are generated.Multiple
IndexedField.SearchSpec
can be defined on singleIndexedField
.Depending on the implementation, indexes can choose to store
IndexedField
andIndexedField.SearchSpec
separately. The searches are issues toIndexedField.SearchSpec
.
-
-
Constructor Summary
Constructors Constructor Description SearchSpec(String name, SearchOption searchOption)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get(I obj)
Get the field contents from the input object.IndexedField<I,T>
getField()
ReturnsIndexedField
on which this spec was created.String
getName()
Returns the name of the field.SearchOption
getSearchOption()
ReturnsSearchOption
enabled on this field.FieldType<?>
getType()
Returns type of the field; for repeatable fields, the inner type, not the iterable type.boolean
isRepeatable()
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 Detail
-
SearchSpec
public SearchSpec(String name, SearchOption searchOption)
-
-
Method Detail
-
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
public T get(I obj)
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
public String getName()
Description copied from interface:SchemaFieldDefs.SchemaField
Returns the name of the field.- Specified by:
getName
in interfaceSchemaFieldDefs.SchemaField<I,T>
-
getType
public FieldType<?> 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
public boolean setIfPossible(I object, StoredValue doc)
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
public SearchOption getSearchOption()
ReturnsSearchOption
enabled on this field.- Returns:
SearchOption
-
getField
public IndexedField<I,T> getField()
ReturnsIndexedField
on which this spec was created.- Returns:
- original
IndexedField
of this spec.
-
-