@Unstable public abstract class AbstractSolrCoreInitializer extends Object implements SolrCoreInitializer
SolrCoreInitializer
.Modifier and Type | Field and Description |
---|---|
protected org.apache.solr.client.solrj.SolrClient |
client |
protected org.xwiki.component.descriptor.ComponentDescriptor<SolrCoreInitializer> |
descriptor |
protected Map<String,Map<String,Object>> |
fields |
static long |
SCHEMA_BASE_VERSION
The base schema version.
|
static long |
SCHEMA_VERSION_12_10
The base schema version for XWiki 12.10.
|
static long |
SCHEMA_VERSION_12_3
The base schema version for XWiki 12.3.
|
static long |
SCHEMA_VERSION_12_5
The base schema version for XWiki 12.5.
|
static long |
SCHEMA_VERSION_12_6
The base schema version for XWiki 12.6.
|
protected static String |
SOLR_FIELD_DOCVALUES
The name of the attribute indicating if the value of the field will be put in a column-oriented DocValues
structure.
|
static String |
SOLR_FIELD_ID
The name of the field containing the identifier of the document.
|
protected static String |
SOLR_FIELD_INDEXED
The name of the attribute indicating if the Solr field should be indexed.
|
protected static String |
SOLR_FIELD_MULTIVALUED
The name of the attribute indicating that a single document might contain multiple values for this Solr field
type.
|
protected static String |
SOLR_FIELD_NAME
The name of the attribute containing the name of the Solr field.
|
protected static String |
SOLR_FIELD_SORTMISSINGLAST
The name of the attribute Control the placement of documents when a sort field is not present.
|
protected static String |
SOLR_FIELD_STORED
The name of the attribute indicating if the Solr field should be stored.
|
protected Map<String,org.apache.solr.client.solrj.response.schema.FieldTypeRepresentation> |
types |
Constructor and Description |
---|
AbstractSolrCoreInitializer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addBinaryField(String name,
boolean dynamic)
Binary data.
|
protected void |
addBooleanField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addCopyField(String source,
String... dest)
Add a copy field.
|
protected void |
addField(Map<String,Object> fieldAttributes,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addField(String name,
String type,
boolean dynamic,
Object... attributes)
Add a field in the Solr schema.
|
protected void |
addFieldType(String name,
String solrClass,
Object... attributes)
Add a field type in the Solr schema.
|
protected void |
addMapField(String name)
Binary data.
|
protected void |
addPDateField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addPDoubleField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addPFloatField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addPIntField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addPLongField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addStringField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
addTextGeneralField(String name,
boolean multiValued,
boolean dynamic)
Add a field in the Solr schema.
|
protected void |
commit()
Performs an explicit commit, causing pending documents to be committed for indexing.
|
protected abstract void |
createSchema()
Create the schema from scratch.
|
protected void |
deleteField(String fieldName,
boolean dynamic)
Delete a field in the Solr schema.
|
String |
getCoreName() |
protected Long |
getCurrentCoreVersion() |
protected Long |
getCurrentXWikiVersion() |
protected Map<String,Map<String,Object>> |
getFields(boolean force) |
protected Map<String,org.apache.solr.client.solrj.response.schema.FieldTypeRepresentation> |
getFieldTypes(boolean force) |
protected abstract long |
getVersion() |
void |
initialize(org.apache.solr.client.solrj.SolrClient client)
Initialize the client after its creation.
|
protected void |
initializeBaseSchema() |
protected void |
initializeCoreSchema() |
protected abstract void |
migrateSchema(long cversion)
Migrate the existing schema.
|
protected void |
replaceFieldType(String name,
String solrClass,
Object... attributes)
Replace a field type in the Solr schema.
|
protected void |
setBinaryField(String name,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setBooleanField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setCurrentCoreVersion(boolean add) |
protected void |
setCurrentXWikiVersion(boolean add) |
protected void |
setField(Map<String,Object> fieldAttributes,
boolean dynamic)
Add or replace a field in the Solr schema.
|
protected void |
setField(String name,
String type,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setFieldType(org.apache.solr.client.solrj.request.schema.FieldTypeDefinition definition,
boolean add)
Add a field type in the Solr schema.
|
protected void |
setFieldType(Map<String,Object> attributes,
boolean add)
Add a field type in the Solr schema.
|
protected void |
setFieldType(String name,
String solrClass,
boolean add,
Object... attributes)
Add a field type in the Solr schema.
|
protected void |
setMapField(String name,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setPDateField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setPDoubleField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setPFloatField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setPIntField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setPLongField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setStringField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
protected void |
setTextGeneralField(String name,
boolean multiValued,
boolean dynamic,
Object... attributes)
Add or replace a field in the Solr schema.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isCache
public static final String SOLR_FIELD_ID
public static final long SCHEMA_VERSION_12_3
public static final long SCHEMA_VERSION_12_5
public static final long SCHEMA_VERSION_12_6
public static final long SCHEMA_VERSION_12_10
public static final long SCHEMA_BASE_VERSION
protected static final String SOLR_FIELD_NAME
protected static final String SOLR_FIELD_INDEXED
protected static final String SOLR_FIELD_STORED
protected static final String SOLR_FIELD_SORTMISSINGLAST
protected static final String SOLR_FIELD_MULTIVALUED
protected static final String SOLR_FIELD_DOCVALUES
@Inject protected org.xwiki.component.descriptor.ComponentDescriptor<SolrCoreInitializer> descriptor
protected org.apache.solr.client.solrj.SolrClient client
protected Map<String,org.apache.solr.client.solrj.response.schema.FieldTypeRepresentation> types
public void initialize(org.apache.solr.client.solrj.SolrClient client) throws SolrException
SolrCoreInitializer
initialize
in interface SolrCoreInitializer
client
- to manipulate the coreSolrException
- when failing to initialize the coreprotected Map<String,org.apache.solr.client.solrj.response.schema.FieldTypeRepresentation> getFieldTypes(boolean force) throws SolrException
SolrException
protected Map<String,Map<String,Object>> getFields(boolean force) throws SolrException
SolrException
protected void initializeBaseSchema() throws SolrException
SolrException
protected void initializeCoreSchema() throws SolrException
SolrException
protected abstract void createSchema() throws SolrException
SolrException
- when failing to create the schemaprotected abstract void migrateSchema(long cversion) throws SolrException
cversion
- the version of the schema currently storedSolrException
- when failing to migrate the schemapublic String getCoreName()
getCoreName
in interface SolrCoreInitializer
protected abstract long getVersion()
protected Long getCurrentXWikiVersion() throws SolrException
SolrException
- when failing to get the typeprotected void setCurrentXWikiVersion(boolean add) throws SolrException
SolrException
protected Long getCurrentCoreVersion() throws SolrException
SolrException
- when failing to get the typeprotected void setCurrentCoreVersion(boolean add) throws SolrException
SolrException
protected void addStringField(String name, boolean multiValued, boolean dynamic) throws SolrException
A general text field that has reasonable, generic cross-language defaults: it tokenizes with StandardTokenizer, removes stop words from case-insensitive "stopwords.txt" (empty by default), and down cases. At query time only, it also applies synonyms.
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addTextGeneralField(String name, boolean multiValued, boolean dynamic) throws SolrException
A general text field that has reasonable, generic cross-language defaults: it tokenizes with StandardTokenizer, removes stop words from case-insensitive "stopwords.txt" (empty by default), and down cases. At query time only, it also applies synonyms.
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addBooleanField(String name, boolean multiValued, boolean dynamic) throws SolrException
Contains either true or false. Values of "1", "t", or "T" in the first character are interpreted as true. Any other values in the first character are interpreted as false.
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addPIntField(String name, boolean multiValued, boolean dynamic) throws SolrException
Integer field (32-bit signed integer).
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addPFloatField(String name, boolean multiValued, boolean dynamic) throws SolrException
Floating point field (32-bit IEEE floating point).
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addPLongField(String name, boolean multiValued, boolean dynamic) throws SolrException
Long field (64-bit signed integer).
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addPDoubleField(String name, boolean multiValued, boolean dynamic) throws SolrException
Double field (64-bit IEEE floating point).
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addPDateField(String name, boolean multiValued, boolean dynamic) throws SolrException
Date field. Represents a point in time with millisecond precision.
name
- the name of the field to addmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addBinaryField(String name, boolean dynamic) throws SolrException
name
- the name of the field to adddynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addMapField(String name) throws SolrException
name
- the name of the field to addSolrException
- when failing to add the fieldprotected void addField(String name, String type, boolean dynamic, Object... attributes) throws SolrException
name
- the name of the field to addtype
- the tpe of the field to addddynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to add the fieldprotected void addField(Map<String,Object> fieldAttributes, boolean dynamic) throws SolrException
fieldAttributes
- the attributes of the field to adddynamic
- true to create a dynamic fieldSolrException
- when failing to add the field@Unstable protected void deleteField(String fieldName, boolean dynamic) throws SolrException
fieldName
- the name of the field to delete.dynamic
- true if the field to delete is dynamic.SolrException
- when failing to delete the field.protected void setStringField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
String (UTF-8 encoded string or Unicode). Strings are intended for small fields and are not tokenized or analyzed in any way. They have a hard limit of slightly less than 32K.
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the field@Unstable protected void setTextGeneralField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
A general text field that has reasonable, generic cross-language defaults: it tokenizes with StandardTokenizer, removes stop words from case-insensitive "stopwords.txt" (empty by default), and down cases. At query time only, it also applies synonyms.
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setBooleanField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Contains either true or false. Values of "1", "t", or "T" in the first character are interpreted as true. Any other values in the first character are interpreted as false.
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setPIntField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Integer field (32-bit signed integer).
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setPFloatField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Floating point field (32-bit IEEE floating point).
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setPLongField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Long field (64-bit signed integer).
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setPDoubleField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Double field (64-bit IEEE floating point).
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setPDateField(String name, boolean multiValued, boolean dynamic, Object... attributes) throws SolrException
Date field. Represents a point in time with millisecond precision.
name
- the name of the field to setmultiValued
- true if the field can contain several valuesdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setBinaryField(String name, boolean dynamic, Object... attributes) throws SolrException
Binary data.
name
- the name of the field to setdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setMapField(String name, Object... attributes) throws SolrException
Map data.
name
- the name of the field to setattributes
- attributed to add to the field definitionSolrException
- when failing to set the fieldprotected void setField(String name, String type, boolean dynamic, Object... attributes) throws SolrException
name
- the name of the field to settype
- the type of the field to setdynamic
- true to create a dynamic fieldattributes
- attributed to add to the field definitionSolrException
- when failing to add the fieldprotected void setField(Map<String,Object> fieldAttributes, boolean dynamic) throws SolrException
fieldAttributes
- the attributes of the field to adddynamic
- true to create a dynamic fieldSolrException
- when failing to add the fieldprotected void addCopyField(String source, String... dest) throws SolrException
source
- the source field namedest
- the collection of the destination field namesSolrException
- when failing to add the fieldprotected void addFieldType(String name, String solrClass, Object... attributes) throws SolrException
name
- the name of the field typesolrClass
- the class of the field typeattributes
- the other attributes of the field typeSolrException
- when failing to add the fieldprotected void replaceFieldType(String name, String solrClass, Object... attributes) throws SolrException
name
- the name of the field typesolrClass
- the class of the field typeattributes
- the other attributes of the field typeSolrException
- when failing to add the fieldprotected void setFieldType(String name, String solrClass, boolean add, Object... attributes) throws SolrException
name
- the name of the field typesolrClass
- the class of the field typeadd
- true if the field type should be added, false for replaceattributes
- the other attributes of the field typeSolrException
- when failing to add the fieldprotected void setFieldType(Map<String,Object> attributes, boolean add) throws SolrException
attributes
- the attributes of the field to addadd
- true if the field type should be added, false for replaceSolrException
- when failing to add the field@Unstable protected void setFieldType(org.apache.solr.client.solrj.request.schema.FieldTypeDefinition definition, boolean add) throws SolrException
definition
- the definition of the field to addadd
- true if the field type should be added, false for replaceSolrException
- when failing to add the fieldprotected void commit() throws SolrException
SolrException
- when failing to commitCopyright © 2004–2021 XWiki. All rights reserved.