Interface IDfQueryBuilder

All Superinterfaces:
IDfQueryDefinition, IDfSearchSourceContainer

public interface IDfQueryBuilder extends IDfQueryDefinition
This is a primary interface for building a query that can be executed against sources of different type.
See Also:
  • Field Details

    • OBJ_TYPE_UNDEFINED

      static final String OBJ_TYPE_UNDEFINED
      Represents undefined object type.
      See Also:
    • OBJ_TYPE_DEFAULT

      static final String OBJ_TYPE_DEFAULT
      Represents default object type.
      See Also:
    • DATE_FORMAT_DEFAULT

      static final String DATE_FORMAT_DEFAULT
      Default date format.
  • Method Details

    • getScopeCount

      int getScopeCount()
      Retrieves the query scope count.
      Returns:
      The query scope count.
    • getScopes

      IDfEnumeration getScopes()
      Retrieves an enumeration of the query scopes as IDfQueryScope objects.
      Returns:
      An enumeration of the scopes as IDfQueryScope objects.
    • addLocationScope

      IDfLocationQueryScope addLocationScope(String source, String locationPath, boolean isDescend) throws DfSearchException, DfException
      Adds a location scope. Note: The source, location path and credentials are not controlled in this method. Check them by calling getLocationPath() on the IDfLocationQueryScope returned. Hence it allows adding a location scope when the source is unavailable, the exception will be thrown and handled when the query is generated or run.
      Parameters:
      source - The source scope. It must be a repository.
      locationPath - The path scope inside the source repository.
      isDescend - Whether the scope includes sub-folders.
      Returns:
      The created location scope.
      Throws:
      DfSearchException - If the source is not a repository.
      DfException - If a server error occurs.
      See Also:
    • addLocationScope

      IDfLocationQueryScope addLocationScope(String source, String locationPath, boolean isDescend, boolean isExcluded) throws DfSearchException, DfException
      Adds a location scope. Note: The source, location path and credentials are not controlled in this method. Check them by calling getLocationPath() on the IDfLocationQueryScope returned. Hence it allows adding a location scope when the source is unavailable, the exception will be thrown and handled when the query is generated or run.
      Parameters:
      source - The source scope. It must be a repository.
      locationPath - The path scope inside the source repository.
      isDescend - Whether the scope includes sub-folders.
      isExcluded - Whether the scope should be an excluded scope.
      Returns:
      The created location scope.
      Throws:
      DfSearchException - If the source is not a repository.
      DfException - If a server error occurs.
      See Also:
    • addLocationScope

      IDfLocationQueryScope addLocationScope(String source, IDfId locationId, boolean isDescend, boolean isExcluded) throws DfSearchException, DfException
      Adds a location scope. Note: The source, location path and credentials are not controlled in this method. Check them by calling getLocationPath() on the IDfLocationQueryScope returned. Hence it allows adding a location scope when the source is unavailable, the exception will be thrown and handled when the query is generated or run.
      Parameters:
      source - The source scope. It must be a repository.
      locationId - The id for the folder inside the source repository.
      isDescend - Whether the scope includes sub-folders.
      isExcluded - Whether the scope should be an excluded scope.
      Returns:
      The created location scope.
      Throws:
      DfSearchException - If the source is not a repository.
      DfException - If a server error occurs.
      See Also:
    • addExpressionScope

      IDfExpressionScope addExpressionScope(String source)
      Adds an expression scope. This expression will be merged during execution to the root expression set (getRootExpressionSet()) on either a given Documentum repository source or on all external sources. To create your expression you first need to create the scope then access its IDfExpressionSet.
      Example:
       IDfExpressionScope myScope = myQueryBuilder.addExpressionScope(mySource);
       IDfExpressionSet expression = myScope.getExpression();
       expression.addFullTextExpression(myFTExpression)
       
      Parameters:
      source - The target source of the scope. Target source can be a Documentum repository or IDfExpressionScope.ALL_ECI_SOURCES for all external sources. The expression is ignored and a warning is issued if the target source is the name of a specific external source.
      Returns:
      A new IDfExpressionScope with an empty expression set, you need to access this expression set to create your expression through the API.
      See Also:
    • addPartitionScope

      IDfPartitionScope addPartitionScope(String source, String partitionName) throws DfSearchException, DfException
      Adds a partition scope. A partition is used in Documentum Index Server for partitioning data that are indexed (the term used in Documentum Index Server administrator is 'collection'). Specifying a partition will only query this partition, resulting in performance improvement.

      Multiple partitions per query are supported (since 6.7).

      Partitions are not supported for other indexers or for database search. In these cases, the partition scope is ignored.

      Parameters:
      source - the targeted source.
      partitionName - the name of the partition.
      Returns:
      The newly created and added partition scope.
      Throws:
      DfSearchException - If the source is not a repository.
      DfException - If a server error occurs.
    • getObjectType

      String getObjectType()
      Retrieves search object type (such as dm_document). Only one object type is supported per query.
      Returns:
      The object type name.
    • setObjectType

      void setObjectType(String objectType)
      Sets the object type (such as dm_document) for the query. Only one object type is supported per query.
      Parameters:
      objectType - The name of the type.
    • isFullTextCompliant

      boolean isFullTextCompliant()
      Checks whether this query builder is full-text compliant. FTDQL compliance:
      • Value List and Value Range attribute expressions are not supported.
      • Only repeated ID and String searches are supported.
      • BETWEEN, IN, NOT IN, DOES NOT CONTAIN operations are not supported.
      Returns:
      true if this query builder is full-text compliant; false otherwise.
    • isDatabaseSearchRequested

      boolean isDatabaseSearchRequested()
      Allows to check if RDBMS search semantics are requested. By default, full-text semantics are used, unless explicitly requested otherwise.
      Returns:
      true if RDBMS search semantics are requested.
    • setDatabaseSearchRequested

      void setDatabaseSearchRequested(boolean isRequested)
      Sets RDBMS semantics request option for the query. By default, full-text semantics are used, unless explicitly requested otherwise.
      Parameters:
      isRequested -
    • isIncludeHiddenObjects

      boolean isIncludeHiddenObjects()
      Allows to check if hidden objects are expected to be included into the query results. By default, hidden object are excluded.
      Returns:
      true if hidden objects are to be included.
    • setIncludeHiddenObjects

      void setIncludeHiddenObjects(boolean isInclude)
      Sets an option to include hidden objects into the query results. By default, hidden object are excluded.
      Parameters:
      isInclude -
    • isIncludeAllVersions

      boolean isIncludeAllVersions()
      Allows to check if all versions of the objects are expected to be included into the query results. By default, all versions are excluded.
      Returns:
      true, if all versions are to be included.
    • setIncludeAllVersions

      void setIncludeAllVersions(boolean isInclude)
      Sets an option to include all versions of the objects into the query results. By default, all versions are excluded.
      Parameters:
      isInclude -
    • getDateFormat

      String getDateFormat()
      Retrieves the date format to be used to interpret the Date values. By default, the format is "MM-dd-yyyy hh:mm:ss".
      Returns:
      The current date format.
      See Also:
    • setDateFormat

      void setDateFormat(String dateFormat)
      Sets the date format to be used to interpret the Date values. By default, the format is "mm/dd/yyyy hh:mi:ss".
      Parameters:
      dateFormat -
      See Also:
    • getRootExpressionSet

      IDfExpressionSet getRootExpressionSet()
      Provides access to the root expression set of the query. Root expression set is automatically created for the query on construction. It is empty by default.
      Returns:
      The current root expression set.
    • setRootExpressionSet

      void setRootExpressionSet(IDfExpressionSet expressionSet)
      Sets root expression set for the query.
      Parameters:
      expressionSet - An object representing a set of search expressions.
    • newExpressionSet

      IDfExpressionSet newExpressionSet()
      Factory method to create an expression set not connected to the query. However, it is not a primary way for building query expressions. Use getRootExpressionSet() as a preferred method.
      Returns:
      A new instance of an expression set not connected to the query.
    • getResultAttrCount

      int getResultAttrCount()
      Gets the number of result attributes in this query.
      Returns:
      result The attribute count.
      See Also:
    • getResultAttributes

      IDfEnumeration getResultAttributes()
      Provides an enumeration of the result attributes as String objects.
      Returns:
      An enumeration of the result attributes as String objects.
      See Also:
    • addResultAttribute

      void addResultAttribute(String attrName)
      Adds a result attribute.

      A result attribute is an attribute to be returned in the results list. A result attribute must be a name of an attribute defined in the object type of this query or a specific attribute as defined below.

      "summary" is a specific attribute. It indicates that an extract of the document parts matching the query should be returned for each result. It is not returned if the snapshot is not available (if the indexer is not available or on a pre-5.3 repository).

      Note: the attribute 'r_content_size' is deprecated. If it is used as a result attribute, it will be transformed into r_full_content_size in the results list.

      Additional attributes may be returned in the results without being specified in the result list. This is the case for external sources. External sources do not take into account the result attributes specified here. The attributes returned by external sources are specific to each FS2 Adapter definition.
      Several search specific attributes are also systematically added in the results (sequence number, score, source name...).

      Results attributes are unique. Adding the same attribute twice only adds it once.

      Parameters:
      attrName - Attributes names such as: r_object_id, object_name, summary, i_is_reference.
    • addResultAttribute

      void addResultAttribute(String attrName, boolean isRepeating, int dataType)
      Adds a result attribute and forcefully set the repeating attribute.
      This function should ONLY be used when you have a repeating attribute in child types but you want to search with parent type.

      A result attribute is an attribute to be returned in the results list. A result attribute must be a name of an attribute defined in the object type of this query or a specific attribute as defined below.

      "exclusive_string_repeating" is a specific attribute. It indicates that an extract of the document parts matching the query should be returned for each result. It is not returned if the snapshot is not available (if the indexer is not available or on a pre-5.3 repository).

      Note: the attribute 'r_content_size' is deprecated. If it is used as a result attribute, it will be transformed into r_full_content_size in the results list.

      Additional attributes may be returned in the results without being specified in the result list. This is the case for external sources. External sources do not take into account the result attributes specified here. The attributes returned by external sources are specific to each FS2 Adapter definition.
      Several search specific attributes are also systematically added in the results (sequence number, score, source name...).

      Results attributes are unique. Adding the same attribute twice only adds it once.

      Parameters:
      attrName - Attributes names such as: exclusive_string_repeating.
      isRepeating - Whether this attribute is repeating. This parameter will override the repeating attribute of a field in object type.
      dataType - The repeating data type can be IDfValue.DF_BOOLEAN, IDfValue.DF_DOUBLE, IDfValue.DF_ID, IDfValue.DF_INTEGER, IDfValue.DF_STRING or IDfValue.DF_TIME.
    • isAttributeRepeating

      Boolean isAttributeRepeating(String attrName)
      Call this function to check if an attribute is repeating or not.
      This function should ONLY be used for attribute added by calling addResultAttribute(String attrName, boolean isRepeating, int dataType).
      Parameters:
      attrName - Attributes names such as: exclusive_string_repeating.
      Returns:
      true if the attribute has been set to repeating, false if the attribute has been set to not repeating or null if the attribute has not been forcefully set to repeating.
    • getAttributeDataType

      Integer getAttributeDataType(String attrName)
      Call this function to get the data type of an attribute.
      This function should ONLY be used for attribute added by calling addResultAttribute(String attrName, boolean isRepeating, int dataType).
      Parameters:
      attrName - Attributes names such as: exclusive_string_repeating.
      Returns:
      Data type of the attribute if the attribute has been forcefully set as repeating or null if the attribute has not been forcefully set to repeating.
    • addOrderByAttribute

      void addOrderByAttribute(String attrName, boolean isAsc)
      Specifies an attribute to sort the results list. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      See Also:
    • addOrderByAttribute

      void addOrderByAttribute(String attrName, boolean isAsc, String type)
      Specifies an attribute to sort the results list. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      type - type of the attribute, may be XMLQueryConstants.ATTR_EXPR_DATA_TYPE_STRING, XMLQueryConstants.ATTR_EXPR_DATA_TYPE_INTEGER or XMLQueryConstants.ATTR_EXPR_DATA_TYPE_DOUBLE. Type is only supported by xQuery and will be ignored in DQL queries. Type is required ONLY when you need to order by a string field as integer or double.
      See Also:
    • addOrderByAttribute

      void addOrderByAttribute(String attrName, boolean isAsc, Locale locale)
      Specifies an attribute to sort the results list. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      locale - define a specific locale to use to sort the results. This Locale is only supported by xPlore since 1.3 and is ignored in DQL queries.
      Since:
      7.0
      See Also:
    • addOrderByAttribute

      void addOrderByAttribute(String attrName, boolean isAsc, Locale locale, String type)
      Specifies an attribute to sort the results list. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      locale - define a specific locale to use to sort the results. This Locale is only supported by xPlore since 1.3 and is ignored in DQL queries.
      type - type of the attribute, may be XMLQueryConstants.ATTR_EXPR_DATA_TYPE_STRING, XMLQueryConstants.ATTR_EXPR_DATA_TYPE_INTEGER or XMLQueryConstants.ATTR_EXPR_DATA_TYPE_DOUBLE. Type is only supported by xQuery and will be ignored in DQL queries. Type is required ONLY when you need to order by a string field as integer or double.
      Since:
      7.0
      See Also:
    • addASCIIOrderByAttribute

      void addASCIIOrderByAttribute(String attrName, boolean isAsc)
      Specifies an attribute to sort the results list using an ASCII sort. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature This ASCII sort is only supported by xPlore since 1.3 in DQL queries it will be use like a common order by.
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      Since:
      7.0
      See Also:
    • addASCIIOrderByAttribute

      void addASCIIOrderByAttribute(String attrName, boolean isAsc, String type)
      Specifies an attribute to sort the results list using an ASCII sort. The results list can be sorted by several attributes. The first order attribute added will be the first one used to sort the results list. Then, the next order attribute added will be used to sort the previously sorted results list as a secondary criteria. An order attribute cannot be added twice : to sum up, the list of order attributes is an ordered set. These order attributes are not taken into account by external sources or with search complex object feature This ASCII sort is only supported by xPlore since 1.3 in DQL queries it will be use like a common order by.
      Parameters:
      attrName - the query results are sorted by the attribute attrName.
      isAsc - you can sort in ascending or descending order. If this boolean is set to true, the query results is sorted in ascending order.
      type - type of the attribute, may be XMLQueryConstants.ATTR_EXPR_DATA_TYPE_STRING, XMLQueryConstants.ATTR_EXPR_DATA_TYPE_INTEGER or XMLQueryConstants.ATTR_EXPR_DATA_TYPE_DOUBLE. Type is only supported by xQuery and will be ignored in DQL queries. Type is required ONLY when you need to order by a string field as integer or double.
      Since:
      7.0
      See Also:
    • removeOrderByAttribute

      void removeOrderByAttribute(String attrName)
      Removes an order attribute.
      Parameters:
      attrName - the name of the order attribute to remove
    • removeAllOrderByAttributes

      void removeAllOrderByAttributes()
      Removes all the order attributes.
    • getOrderByAttributes

      IDfEnumeration getOrderByAttributes()
      Provides an enumeration of the order attributes as IDfOrderConstraint objects.
      Returns:
      enumeration of the order attributes as IDfOrderConstraint objects.
      See Also:
    • addFacetDefinition

      void addFacetDefinition(DfFacetDefinition definition)
      Adds a facet definition to this query.
    • getFacetsDefinition

      Iterable<DfFacetDefinition> getFacetsDefinition()
      Returns the list of facet definition for this query.
    • setMaxResultsForFacets

      void setMaxResultsForFacets(int max)
      Sets the maximum number of results to be used to compute facets. By default, it will use the maximum number set in the index server configuration.
    • getMaxResultsForFacets

      Integer getMaxResultsForFacets()
      Returns the maximum number of results used to compute facets.
      Returns:
      null if it is not set.
    • isCutoffMessageRetrieved

      boolean isCutoffMessageRetrieved()
      Indicates if the query needs to retrieve the cutoff message.
      Returns:
      true if the cutoff message should be retrieved.
    • setCutoffMessageRetrieved

      void setCutoffMessageRetrieved(boolean cutoffMessageRetrieved)
      Sets an option to retrieve the cutoff message.
      Parameters:
      cutoffMessageRetrieved - Whether the cutoff message should be retrieved.
    • isRangeAccessSupported

      boolean isRangeAccessSupported()
      Indicates if only one part of the matching results can be retrieved, from one lowerbound index to an upperbound one
      Returns:
      true if there is only one source and if range access is supported by it.
    • isHitcountRetrieved

      boolean isHitcountRetrieved()
      Indicates if the query needs to retrieve the hitcount separately : if facets are asked, the hitcount will be returned even if this method returned false.
      Returns:
      true if the hitcount is retrieved.
    • setHitcountRetrieved

      void setHitcountRetrieved(boolean isHitcountAsked)
      Sets an option to retrieve the hitcount This option is taken into account only if the backend is xPlore. The default value is false, except if the facets are computed. Then, this option is ignored, the hitcount is returned by default
      Parameters:
      isHitcountAsked -
    • setMaxHitcount

      void setMaxHitcount(Integer maxHitcount)
      Sets the maximum number of results to be counted and returned as the hitcount. By default, if it's not explicitly set, this max number is 10000.
    • getMaxHitcount

      Integer getMaxHitcount()
      Returns the maximum number of results to be counted and returned as the hitcount.
      Returns:
      null if it is not set.
    • setLocale

      void setLocale(String locale)
      Set a locale to be used for this particular query. The locale influence how the query is evaluated. It is used to parse word into language dependent token.
      This option is only supported with xPlore. It is silently ignored on other search sources.
      By default, the locale is picked from the session manager.
    • getLocale

      String getLocale()
      Return the locale to be used for this particular query.
      Returns:
      null if the locale has not been set.
    • addMetadataHighlightAttribute

      void addMetadataHighlightAttribute(String attrName)
      Specifies an metadata attribute to highlight. An metadata attribute cannot be added twice : to sum up, the list of metadata attribute attributes is an ordered set. This metadata highlight is only supported by xPlore since 1.6.
      Parameters:
      attrName - the highlight metadata attribute attrName.
      Since:
      7.3
    • removeMetadataHighlightAttribute

      void removeMetadataHighlightAttribute(String attrName)
      Removes an metadata highlight attribute.
      Parameters:
      attrName - the name of the metadata highlight attribute to remove
    • getMetadataHighlightAttributes

      IDfEnumeration getMetadataHighlightAttributes()
      Provides an enumeration of the metadata highlight attributes as String objects.
      Returns:
      enumeration of the metadata highlight attributes as String objects.
      See Also:
      • #addMetadataHighlightAttribute(String,boolean)