Class AlfrescoSolrDataModel

java.lang.Object
org.alfresco.solr.AlfrescoSolrDataModel
All Implemented Interfaces:
org.alfresco.repo.search.adaptor.QueryConstants

public class AlfrescoSolrDataModel extends Object implements org.alfresco.repo.search.adaptor.QueryConstants
Author:
Andy
  • Field Details

  • Constructor Details

    • AlfrescoSolrDataModel

      public AlfrescoSolrDataModel()
  • Method Details

    • close

      public void close()
    • getTenantId

      public static String getTenantId(String tenant)
    • getAclDocumentId

      public static String getAclDocumentId(String tenant, Long aclId)
      Returns the ACL Document identifier in the following format <TENANT>!<ACLID>!ACL
      Parameters:
      tenant - the tenant code.
      aclId - the acl identifer
      Returns:
      the ACL Document identifier (<TENANT>!<ACLID>!ACL)
    • getAclChangeSetDocumentId

      public static String getAclChangeSetDocumentId(Long aclChangeSetId)
      Returns the ACL ChangeSet Document identifier in the following format TRACKER!CHANGESET!<ACL_CHANGESET_ID>
      Parameters:
      aclChangeSetId - the ACL changeset identifier.
      Returns:
      the ACL ChangeSet Document identifier (TRACKER!CHANGESET!<ACL_CHANGESET_ID>)
    • parseTransactionId

      public static Long parseTransactionId(String documentId)
      Extracts the transaction identifier from the input document identifier. The "input document identifier" is the alphanumeric identifier used for Solr documents.
      Parameters:
      documentId - the document identifier.
      Returns:
      the numeric ACL changeset identifier.
    • getNodeDocumentId

      public static String getNodeDocumentId(String tenant, Long dbid)
      Returns the Solr document identifier in the following format <TENANT>!<!<DBID>
      Parameters:
      tenant - the tenant code.
      dbid - the DB identifier.
      Returns:
      the Solr document identifier in the following format <TENANT>!<!<DBID>
    • decodeNodeDocumentId

      public static AlfrescoSolrDataModel.TenantDbId decodeNodeDocumentId(String id)
      Destructures a document identifier in the three compounding parts (tenant and dbid).
      Parameters:
      id - the document identifier.
      Returns:
      a AlfrescoSolrDataModel.TenantDbId instance containing the destructured identifier.
    • getTransactionDocumentId

      public static String getTransactionDocumentId(Long txId)
      Returns the Transaction Document identifier in the following format TRACKER!TX!<TX_ID>
      Parameters:
      txId - the transaction identifier.
      Returns:
      the Transaction Document identifier in the following format TRACKER!TX!<TX_ID>
    • getAlfrescoPropertyFromSchemaField

      public String getAlfrescoPropertyFromSchemaField(String schemaField)
    • getInstance

      public static AlfrescoSolrDataModel getInstance()
    • getNamespaceDAO

      public org.alfresco.repo.dictionary.NamespaceDAO getNamespaceDAO()
    • getCommonConfig

      public static Properties getCommonConfig()
    • getResourceClassLoader

      public ClassLoader getResourceClassLoader()
      Returns:
      ClassLoader
    • getResourceDirectory

      public static File getResourceDirectory()
    • getDictionaryService

      public org.alfresco.repo.dictionary.DictionaryComponent getDictionaryService(String alternativeDictionary)
      Gets a DictionaryService, if an Alternative dictionary is specified it tries to get that. It will attempt to get the DEFAULT dictionary service if null is specified or it can't find a dictionary with the name of "alternativeDictionary"
      Parameters:
      alternativeDictionary - - can be null;
      Returns:
      DictionaryService
    • getIndexedFieldForSpecializedPropertyMetadata

      public AlfrescoSolrDataModel.IndexedField getIndexedFieldForSpecializedPropertyMetadata(org.alfresco.service.namespace.QName propertyQName, AlfrescoSolrDataModel.SpecializedFieldType type)
    • getQueryableFields

      public AlfrescoSolrDataModel.IndexedField getQueryableFields(org.alfresco.service.namespace.QName propertyQName, AlfrescoSolrDataModel.SpecializedFieldType type, AlfrescoSolrDataModel.FieldUse fieldUse)
    • getStoredTextField

      public String getStoredTextField(org.alfresco.service.namespace.QName propertyQName)
    • getStoredTextField

      public String getStoredTextField(org.alfresco.service.namespace.QName propertyQName, String suffix)
    • getStoredMLTextField

      public String getStoredMLTextField(org.alfresco.service.namespace.QName propertyQName)
    • getStoredMLTextField

      public String getStoredMLTextField(org.alfresco.service.namespace.QName propertyQName, String suffix)
    • getStoredContentField

      public String getStoredContentField(org.alfresco.service.namespace.QName propertyQName)
    • getStoredContentField

      public String getStoredContentField(org.alfresco.service.namespace.QName propertyQName, String suffix)
    • getDateDerivedField

      public String getDateDerivedField(org.alfresco.service.namespace.QName propertyQName, String suffix)
    • getDateDerivedSuffix

      public String getDateDerivedSuffix(AlfrescoSolrDataModel.SpecializedFieldType type)
    • getIndexedFieldNamesForProperty

      public AlfrescoSolrDataModel.IndexedField getIndexedFieldNamesForProperty(org.alfresco.service.namespace.QName propertyQName)
      Get all the field names into which we must copy the source data
      Parameters:
      propertyQName - QName
      Returns:
      IndexedField
    • isTextField

      public boolean isTextField(org.alfresco.service.cmr.dictionary.PropertyDefinition propertyDefinition)
    • getFieldForNonText

      public String getFieldForNonText(org.alfresco.service.cmr.dictionary.PropertyDefinition propertyDefinition)
    • getPropertyDefinition

      public org.alfresco.service.cmr.dictionary.PropertyDefinition getPropertyDefinition(org.alfresco.service.namespace.QName propertyQName)
    • putModel

      public boolean putModel(org.alfresco.repo.dictionary.M2Model model)
    • removeModel

      public void removeModel(org.alfresco.service.namespace.QName modelQName)
    • afterInitModels

      public void afterInitModels()
    • parseCMISQueryToAlfrescoAbstractQuery

      public org.alfresco.repo.search.impl.querymodel.Query parseCMISQueryToAlfrescoAbstractQuery(org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode mode, org.alfresco.service.cmr.search.SearchParameters searchParameters, org.apache.solr.request.SolrQueryRequest req, String alternativeDictionary, org.apache.chemistry.opencmis.commons.enums.CmisVersion cmisVersion)
    • getCMISFunctionEvaluationContext

      public org.alfresco.opencmis.search.CmisFunctionEvaluationContext getCMISFunctionEvaluationContext(org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode mode, org.apache.chemistry.opencmis.commons.enums.CmisVersion cmisVersion, String alternativeDictionary)
    • getCMISDictionary

      public org.alfresco.opencmis.dictionary.CMISDictionaryService getCMISDictionary(String alternativeDictionary, org.apache.chemistry.opencmis.commons.enums.CmisVersion cmisVersion)
      Gets the CMISDictionaryService, if an Alternative dictionary is specified it tries to get that. It will attempt to get the DEFAULT dictionary service if null is specified or it can't find a dictionary with the name of "alternativeDictionary"
      Parameters:
      alternativeDictionary - - can be null;
      Returns:
      CMISDictionaryService
    • getAlfrescoModels

      public List<org.alfresco.solr.client.AlfrescoModel> getAlfrescoModels()
      Returns the Alfresco models associated with the current dictionary.
      Returns:
      the Alfresco models associated with the current dictionary.
    • getCMISQuery

      public org.apache.lucene.search.Query getCMISQuery(org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode mode, org.alfresco.util.Pair<org.alfresco.service.cmr.search.SearchParameters,Boolean> searchParametersAndFilter, org.apache.solr.request.SolrQueryRequest req, org.alfresco.repo.search.impl.querymodel.Query queryModelQuery, org.apache.chemistry.opencmis.commons.enums.CmisVersion cmisVersion, String alternativeDictionary) throws org.apache.lucene.queryparser.classic.ParseException
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • getLuceneQueryBuilderContext

      public org.alfresco.repo.search.impl.querymodel.impl.lucene.QueryBuilderContext<org.apache.lucene.search.Query,org.apache.lucene.search.Sort,org.apache.lucene.queryparser.classic.ParseException> getLuceneQueryBuilderContext(org.alfresco.service.cmr.search.SearchParameters searchParameters, org.apache.solr.request.SolrQueryRequest req, String alternativeDictionary, org.alfresco.repo.search.impl.parsers.FTSQueryParser.RerankPhase rerankPhase)
    • getLuceneQueryParser

      public Solr4QueryParser getLuceneQueryParser(org.alfresco.service.cmr.search.SearchParameters searchParameters, org.apache.solr.request.SolrQueryRequest req, org.alfresco.repo.search.impl.parsers.FTSQueryParser.RerankPhase rerankPhase)
    • getFTSQuery

      public org.apache.lucene.search.Query getFTSQuery(org.alfresco.util.Pair<org.alfresco.service.cmr.search.SearchParameters,Boolean> searchParametersAndFilter, org.apache.solr.request.SolrQueryRequest req, org.alfresco.repo.search.impl.parsers.FTSQueryParser.RerankPhase rerankPhase) throws org.apache.lucene.queryparser.classic.ParseException
      Throws:
      org.apache.lucene.queryparser.classic.ParseException
    • mapProperty

      public String mapProperty(String potentialProperty, AlfrescoSolrDataModel.FieldUse fieldUse, org.apache.solr.request.SolrQueryRequest req)
    • mapStoredProperty

      public String mapStoredProperty(String potentialProperty, org.apache.solr.request.SolrQueryRequest req)
      return the stored field associated to potentialProperty parameter
    • isDerivedDateField

      public boolean isDerivedDateField(String suffix)
    • mapProperty

      public String mapProperty(String potentialProperty, AlfrescoSolrDataModel.FieldUse fieldUse, org.apache.solr.request.SolrQueryRequest req, int position)
    • mapNonPropertyFields

      public String mapNonPropertyFields(String queryField)
    • getTextField

      public AlfrescoSolrDataModel.SpecializedFieldType getTextField(String ending)
      Parameters:
      ending - String
      Returns:
      SpecializedFieldType
    • setCMDefaultUri

      public void setCMDefaultUri()
    • destructuredDateTimePartFieldNamePrefix

      public String destructuredDateTimePartFieldNamePrefix(String sourceFieldName)
      Returns the prefix used for denoting a field which is meant to represent a constituent part of a date or datetime (e.g. year, month, second, minute).
      Parameters:
      sourceFieldName - the date/datetime source field name.
      Returns:
      the prefix that can be used for denoting a date or datetime part