Class 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 the SolrIndexer. Queries on the index are performed using XWiki's Query Module API with query type "solr".
    Since:
    4.3M2
    Version:
    $Id: 0539b9f49ce8be96c6352510cb284a778db654d5 $
    • 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
    • Constructor Detail

      • SolrIndexScriptService

        public SolrIndexScriptService()
    • 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 a DocumentReference from the given SolrDocument (e.g. search result).
        Parameters:
        document - the SolrDocument to extract the DocumentReference from
        parameters - 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 an EntityReference from the given SolrDocument (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 existing EntityType).
        Parameters:
        document - a SolrDocument to extract the EntityReference 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 an EntityReference of the specified type from the given SolrDocument (e.g. search result).
        Parameters:
        document - a SolrDocument to extract the EntityReference from
        type - the entity type
        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