public static class TextIndex.Builder extends com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
Modifier and Type | Method and Description |
---|---|
TextIndex.Builder |
analyzer(java.lang.String analyzer)
Configure the analyzer for the text index.
|
TextIndex.Builder |
bool(java.lang.String... fieldNames)
Add a field containing boolean values to the text index configuration.
|
TextIndex.Builder |
defaultField(boolean enabled,
java.lang.String analyzer)
Configure the default field for the text index.
|
TextIndex.Builder |
designDocument(java.lang.String designDocumentId)
Configure the design document name, if not set a new design document will be created with
a generated name.
|
TextIndex.Builder |
indexArrayLengths(boolean indexArrayLengths) |
TextIndex.Builder |
name(java.lang.String indexName)
Configure the name of the index, if not set a name will be generated.
|
protected TextIndex |
newInstance() |
TextIndex.Builder |
number(java.lang.String... fieldNames)
Add one or more fields containing numerical values to the text index configuration.
|
TextIndex.Builder |
partialFilterSelector(Selector selector)
Configure a selector to choose documents that should be added to the index.
|
protected TextIndex.Builder |
returnThis() |
TextIndex.Builder |
string(java.lang.String... fieldNames)
Add one or more fields containing string values to the text index configuration.
|
protected TextIndex.Builder returnThis()
returnThis
in class com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
public TextIndex.Builder name(java.lang.String indexName)
name
in class com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
indexName
- name of the indexpublic TextIndex.Builder designDocument(java.lang.String designDocumentId)
designDocument
in class com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
designDocumentId
- design document ID (the _design prefix is added if not supplied)public TextIndex.Builder partialFilterSelector(Selector selector)
Configure a selector to choose documents that should be added to the index.
Obtain a selector from an Operation
or Expression
.
partialFilterSelector
in class com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
selector
- Selector
object describing criteria used to add
documents to indexSelector
,
selector syntaxprotected TextIndex newInstance()
newInstance
in class com.cloudant.client.internal.query.Builder<TextIndex,com.cloudant.client.api.query.TextIndex.Definition,TextIndex.Builder,TextIndex.Field>
public TextIndex.Builder defaultField(boolean enabled, java.lang.String analyzer)
enabled
- true to enable the default fieldanalyzer
- analyzer to use for the default fieldpublic TextIndex.Builder analyzer(java.lang.String analyzer)
Configure the analyzer for the text index.
The analyzer can be a simple string or a more complex JSON object, as shown in the following examples:
Configure the "keyword" analyzer:
TextIndex.builder().analyzer("keyword");
Configure different analyzers for different fields:
String analyzerString = "{\"name\": \"perfield\"," +
"\"default\": \"english\"," +
"\"fields\": {" +
"\"spanish\": \"spanish\"," +
"\"german\": \"german\"}}";
TextIndex.builder().analyzer(analyzerString);
analyzer
- either a simple string or a complex JSON object, represented as a stringpublic TextIndex.Builder indexArrayLengths(boolean indexArrayLengths)
indexArrayLengths
- true if the indexer should search for arrays and store their
lengthspublic TextIndex.Builder string(java.lang.String... fieldNames)
fieldNames
- names of the fields to indexpublic TextIndex.Builder number(java.lang.String... fieldNames)
fieldNames
- names of the fields to indexpublic TextIndex.Builder bool(java.lang.String... fieldNames)
fieldNames
- name of the field to index