Package org.xwiki.search.solr.script
Class SolrIndexScriptService
- java.lang.Object
-
- org.xwiki.search.solr.script.SolrIndexScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("solr") @Singleton public class SolrIndexScriptService extends Object implements org.xwiki.script.service.ScriptService
Script service exposing interaction with theSolrIndexer
. Queries on the index are performed using XWiki's Query Module API with query type "solr".- Since:
- 4.3M2
- Version:
- $Id: 0539b9f49ce8be96c6352510cb284a778db654d5 $
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT_LASTEXCEPTION
Field name of the last API exception inserted in context.
-
Constructor Summary
Constructors Constructor Description SolrIndexScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(List<EntityReference> references)
Delete multiple entities and all their contained entities recursively.void
delete(EntityReference reference)
Delete an indexed entity and all its contained entities recursively.int
getQueueSize()
void
index(List<EntityReference> references)
Index multiple entities and all their contained entities recursively.void
index(EntityReference reference)
Index an entity and all it's contained entities recursively.EntityReference
resolve(org.apache.solr.common.SolrDocument document, Object... parameters)
Extract anEntityReference
from the givenSolrDocument
(e.g.EntityReference
resolve(org.apache.solr.common.SolrDocument document, EntityType type, Object... parameters)
Extract anEntityReference
of the specified type from the givenSolrDocument
(e.g.DocumentReference
resolveDocument(org.apache.solr.common.SolrDocument document, Object... parameters)
Extract aDocumentReference
from the givenSolrDocument
(e.g.
-
-
-
Field Detail
-
CONTEXT_LASTEXCEPTION
public static final String CONTEXT_LASTEXCEPTION
Field name of the last API exception inserted in context.- See Also:
- Constant Field Values
-
-
Method Detail
-
index
public void index(EntityReference reference)
Index an entity and all it's contained entities recursively.Null reference means the whole farm.
- Parameters:
reference
- the reference to index.
-
index
public void index(List<EntityReference> references)
Index multiple entities and all their contained entities recursively. This is a batch operation.Null reference means the whole farm.
- Parameters:
references
- the references to index.
-
delete
public void delete(EntityReference reference)
Delete an indexed entity and all its contained entities recursively.Null reference means the whole farm.
- Parameters:
reference
- the reference to delete from the index.
-
delete
public void delete(List<EntityReference> references)
Delete multiple entities and all their contained entities recursively. This is a batch operation.Null reference means the whole farm.
- Parameters:
references
- the references to delete from the index.
-
getQueueSize
public int getQueueSize()
- Returns:
- the size of the index/delete queue
- Since:
- 5.1RC1
-
resolveDocument
public DocumentReference resolveDocument(org.apache.solr.common.SolrDocument document, Object... parameters)
Extract aDocumentReference
from the givenSolrDocument
(e.g. search result).- Parameters:
document
- theSolrDocument
to extract theDocumentReference
fromparameters
- the parameters to pass to the reference resolver (e.g. in case some reference components are missing)- Returns:
- the reference to the document associated with the given
SolrDocument
- Since:
- 7.2RC1
-
resolve
public EntityReference resolve(org.apache.solr.common.SolrDocument document, Object... parameters)
Extract anEntityReference
from the givenSolrDocument
(e.g. search result). The entity type is inferred from the "type" field which must be specified and must have a valid value (that corresponds to an existingEntityType
).- Parameters:
document
- aSolrDocument
to extract theEntityReference
from (the "type" field must be specified)parameters
- the parameters to pass to the reference resolver (e.g. in case some reference components are missing)- Returns:
- the reference to the entity associated with the given
SolrDocument
- Since:
- 7.2RC1
-
resolve
public EntityReference resolve(org.apache.solr.common.SolrDocument document, EntityType type, Object... parameters)
Extract anEntityReference
of the specified type from the givenSolrDocument
(e.g. search result).- Parameters:
document
- aSolrDocument
to extract theEntityReference
fromtype
- the entity typeparameters
- the parameters to pass to the reference resolver (e.g. in case some reference components are missing)- Returns:
- the reference to the entity associated with the given
SolrDocument
- Since:
- 7.2RC1
-
-