Annotation Type Query


  • @Retention(RUNTIME)
    @Target({METHOD,ANNOTATION_TYPE})
    @Documented
    public @interface Query
    Declare QBE queries directly on repository methods. This allows cleaner queries for more complex cases. This also allows the "tweaking" of basic search parameters in a repository interface without having to use MarkLogicTemplate directly to set them.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String[] extract
      Defines the properties that should be returned for the given query.
      com.marklogic.client.io.Format format
      The document format to match, either XML or JSON.
      String[] options
      To specify any query options to use in the query.
      String optionsName
      Instead of specifying limited query options individually you can persist an options configuration to the database and just reference it to be used in the query.
      String query  
      String[] searchOptions
      Shortcut for some of the search-option configurations available for MarkLogic query options, i.e.
      SelectedMode selected
      Used in conjunction with the extract paths.
      String transform
      The name of a transform to use when returning/saving documents (depends on the type of operations that is annotated).
      Class<? extends ServerTransformer> transformer
      If you need the ability to create a full ServerTransform then you can specify a ServerTransformer implementation that will generate the reader() and writer() transformers.
      QueryType type
      Sometimes it is better to force the use of a range index for equality checks (to point to specific properties instead of any property in a hierarchy).
      String value
      Takes a MarkLogic QBE JSON string to define the actual query to be executed.
    • Element Detail

      • value

        @AliasFor("query")
        String value
        Takes a MarkLogic QBE JSON string to define the actual query to be executed. This one will take precedence over the method name then.
        Returns:
        Default:
        ""
      • query

        @AliasFor("value")
        String query
        Default:
        ""
      • type

        QueryType type
        Sometimes it is better to force the use of a range index for equality checks (to point to specific properties instead of any property in a hierarchy). This allows the ability to do so. Changing to the RANGE type would require a range index created, and possible the @Indexed attribute with the path set on the property in the POJO class.
        Returns:
        Default:
        io.github.malteseduck.springframework.data.marklogic.repository.query.QueryType.VALUE
      • format

        com.marklogic.client.io.Format format
        The document format to match, either XML or JSON. Currently can't match a mix using this approach, you would need a StructuredQueryDefinition using the query builder in order to match both formats. Using the MarkLogic Format instead of DocumentFormat since we allow "UNKNOWN" as the default. Setting this to "UNKNOWN", BINARY" OR "TEXT" would just end up setting the queries as JSON format, since that is default query "language"
        Returns:
        Default:
        com.marklogic.client.io.Format.UNKNOWN
      • extract

        String[] extract
        Defines the properties that should be returned for the given query. Note that only these properties will make it into the domain object returned.
        Returns:
        Default:
        {}
      • selected

        SelectedMode selected
        Used in conjunction with the extract paths. This determines how the extracted nodes are returned. By default this returns specified nodes in their original hierarchy, but you can also specify to just return the extracted nodes, or to exclude the specified nodes.
        Returns:
        Default:
        io.github.malteseduck.springframework.data.marklogic.repository.query.SelectedMode.HIERARCHICAL
      • options

        String[] options
        To specify any query options to use in the query. Since the query could end up as a range query or a text query of some kind, or MarkLogic could add additional options, this is not limited by an enumeration but the query will fail with incorrect options. These options are applied to all the value/range/text queries that are created, so if fine- tuning is required at that level a custom Repository is required.
        Returns:
        Default:
        {}
      • searchOptions

        String[] searchOptions
        Shortcut for some of the search-option configurations available for MarkLogic query options, i.e. "filtered", "unfiltered", sore-logtfidf", "faceted", etc.
        Returns:
        Default:
        {}
      • optionsName

        String optionsName
        Instead of specifying limited query options individually you can persist an options configuration to the database and just reference it to be used in the query. This allows full configuration of the query for the annotated query.
        Returns:
        Default:
        ""
      • transform

        String transform
        The name of a transform to use when returning/saving documents (depends on the type of operations that is annotated). This transform must have been previously configured through the REST API otherwise the operation will fail.
        Returns:
        Default:
        ""
      • transformer

        Class<? extends ServerTransformer> transformer
        If you need the ability to create a full ServerTransform then you can specify a ServerTransformer implementation that will generate the reader() and writer() transformers.
        Returns:
        Default:
        io.github.malteseduck.springframework.data.marklogic.core.convert.ServerTransformer.class