Class TdbFieldTemplate

  • Direct Known Subclasses:
    TdbRendition

    public class TdbFieldTemplate
    extends java.lang.Object
    Container for a specific field's template. These are added to a TdbRecord to create a retrieval profile, i.e. the fields that will be retrieved with every TdbRecord.get() request.
    • Constructor Summary

      Constructors 
      Constructor Description
      TdbFieldTemplate​(java.lang.String name)
      Constructor, create a simple template field
      TdbFieldTemplate​(java.lang.String name, boolean focusOrExtract, boolean summary, int hint)
      Deprecated.
      This method will removed in the next major release.
      TdbFieldTemplate​(java.lang.String name, TdbFieldFetchType mode, int hint)
      Constructor, create a fully specified template field.
      TdbFieldTemplate​(java.lang.String fieldName, java.lang.String baseName)
      Constructor, create a simple template field
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void clear()
      Reset the template to a default state
      java.lang.String getAfterHits()
      Retrieve the string that is to be inserted after query hits when deserializing a record using the TdbRecord class.
      java.lang.String getBaseName()
      Retrieve the name of the base referenced by this template
      java.lang.String getBeforeHits()
      Retrieve the string that is to be inserted before query hits when deserializing a record using the TdbRecord class.
      TdbFieldFetchType getFetchType()
      Return an indication of what to fetch from the field.
      boolean getFieldContent()
      Get whether the field's content should be retrieved.
      TdbFieldFetchOption getFieldFetchOption()
      Returns the fetch option for the field.
      java.lang.String getName()
      Retrieve the name of the field referenced by this template
      int getSizeHint()
      Retrieve any size hint that has been established for the retrieval template
      boolean isFocused()
      Deprecated.
      This method will removed in the next major release.
      boolean isSummarized()
      Deprecated.
      This method will removed in the next major release.
      void setAfterHits​(java.lang.String after)
      Establish the suffix string that will be inserted after query hits when deserializing using the TdbRecord class.
      void setBaseName​(java.lang.String baseName)
      Set the name of the base to be referenced by this template
      void setBeforeHits​(java.lang.String before)
      Establish the prefix string that will be inserted before query hits when deserializing using the TdbRecord class.
      void setFetchType​(TdbFieldFetchType mode)
      Specify what to fetch from the field.
      void setFieldContent​(boolean fetchContent)
      Set whether the field's content should be retrieved.
      void setFieldFetchOption​(TdbFieldFetchOption option)
      Assign the fetch option for the field.
      void setFocused​(boolean focus)
      Deprecated.
      This method will removed in the next major release.
      void setName​(java.lang.String name)
      Set the name of the field to be referenced by this template
      void setSizeHint​(int hint)
      Set the size hint for the retrieval template
      void setSummarized​(boolean summ)
      Deprecated.
      This method will removed in the next major release.
      void setSurroundHits​(java.lang.String markup)
      Set the symmetric string that should be inserted both before and after query hits when retrieving field values from a query result.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TdbFieldTemplate

        public TdbFieldTemplate​(java.lang.String name,
                                TdbFieldFetchType mode,
                                int hint)
        Constructor, create a fully specified template field.
        Parameters:
        name - Name of field to be retrieved
        mode - Specifies what to fetch from the field. Only used for TEXT fields - ignored for all other field types.
        hint - If mode specifies to summarize, extract or focus from a TEXT field, this is a size hint for how much information the application wishes to retrieve.
      • TdbFieldTemplate

        @Deprecated
        public TdbFieldTemplate​(java.lang.String name,
                                boolean focusOrExtract,
                                boolean summary,
                                int hint)
        Deprecated.
        This method will removed in the next major release.
        Constructor, create a fully specified template field.

        The focusOrExtract parameter controls the so-called Keyword-In-Context (KWIC) feature of TRIP. Similar to a TRIPclassic-style SHOW FOCUS, the KWIC will retrieve hits with some surrounding text. However, an important difference is that if a keyword-in-context extract is requested from a field without any hits, text will still be extracted from the field. In this case, up to approximately hint characters will be extracted from the first paragraph of the field.

        Parameters:
        name - Name of field to be retrieved
        focusOrExtract - Should the field be focused on search hits?
        summary - Should the field be summarized?
        hint - If summarized or focused, this is a size hint for how much information the application wishes to retrieve
      • TdbFieldTemplate

        public TdbFieldTemplate​(java.lang.String name)
        Constructor, create a simple template field
        Parameters:
        name - Name of the field to retrieve
      • TdbFieldTemplate

        public TdbFieldTemplate​(java.lang.String fieldName,
                                java.lang.String baseName)
        Constructor, create a simple template field
        Parameters:
        fieldName - Name of the field to retrieve
        baseName - Name of the base where the field is defined
    • Method Detail

      • getName

        public java.lang.String getName()
        Retrieve the name of the field referenced by this template
        Returns:
        The field name
      • setName

        public void setName​(java.lang.String name)
        Set the name of the field to be referenced by this template
        Parameters:
        name - The field name
      • getBaseName

        public java.lang.String getBaseName()
        Retrieve the name of the base referenced by this template
        Returns:
        The base name
      • setBaseName

        public void setBaseName​(java.lang.String baseName)
        Set the name of the base to be referenced by this template
        Parameters:
        baseName - The base name
      • getFetchType

        public TdbFieldFetchType getFetchType()
        Return an indication of what to fetch from the field.
      • setFetchType

        public void setFetchType​(TdbFieldFetchType mode)
        Specify what to fetch from the field.
        Parameters:
        mode - Specifies what to fetch from the field. Only used for TEXT fields - ignored for all other field types.
      • isFocused

        @Deprecated
        public boolean isFocused()
        Deprecated.
        This method will removed in the next major release.
        Check if the field template requests a focused retrieval, ie hit terms in context.

        This controls the so-called Keyword-In-Context (KWIC) feature of TRIP. Similar to a TRIPclassic-style SHOW FOCUS, the KWIC will retrieve hits with some surrounding text. However, an important difference is that if a keyword-in-context extract is requested from a field without any hits, text will still be extracted from the field. In this case, up to approximately hint characters will be extracted from the first paragraph of the field.

        Returns:
        true if the field template requests focused retrieval
      • setFocused

        @Deprecated
        public void setFocused​(boolean focus)
        Deprecated.
        This method will removed in the next major release.
        Establish the field template request as focused or not.

        This controls the so-called Keyword-In-Context (KWIC) feature of TRIP. Similar to a TRIPclassic-style SHOW FOCUS, the KWIC will retrieve hits with some surrounding text. However, an important difference is that if a keyword-in-context extract is requested from a field without any hits, text will still be extracted from the field. In this case, up to approximately hint characters will be extracted from the first paragraph of the field.

        Parameters:
        focus - If true, any retrieval requests made using this template will use hit term in context retrieval
      • isSummarized

        @Deprecated
        public boolean isSummarized()
        Deprecated.
        This method will removed in the next major release.
        Check if the field template requests the field to be summarized
        Returns:
        true if the field template requests the field to be summarized
      • setSummarized

        @Deprecated
        public void setSummarized​(boolean summ)
        Deprecated.
        This method will removed in the next major release.
        Establish the summarization parameter for the field template
        Parameters:
        summ - If true, any retrieval requests made using this template will use summarization on the field's content
      • getSizeHint

        public int getSizeHint()
        Retrieve any size hint that has been established for the retrieval template
        Returns:
        If the field is either to be focused or summarized, the size hint is used by the server to establish a minimum number of characters to retrieve.
      • setSizeHint

        public void setSizeHint​(int hint)
        Set the size hint for the retrieval template
        Parameters:
        hint - If the field is either to be focused or summarized, the size hint is used by the server to establish a minimum number of characters to retrieve.
      • getBeforeHits

        public java.lang.String getBeforeHits()
        Retrieve the string that is to be inserted before query hits when deserializing a record using the TdbRecord class.
        Returns:
        Any hit prefix that has been established
      • setBeforeHits

        public void setBeforeHits​(java.lang.String before)
        Establish the prefix string that will be inserted before query hits when deserializing using the TdbRecord class.
        Parameters:
        before - The prefix string
      • getAfterHits

        public java.lang.String getAfterHits()
        Retrieve the string that is to be inserted after query hits when deserializing a record using the TdbRecord class.
        Returns:
        Any hit suffix that has been established
      • setAfterHits

        public void setAfterHits​(java.lang.String after)
        Establish the suffix string that will be inserted after query hits when deserializing using the TdbRecord class.
        Parameters:
        after - The suffix string
      • setSurroundHits

        public void setSurroundHits​(java.lang.String markup)
        Set the symmetric string that should be inserted both before and after query hits when retrieving field values from a query result.
        This property assumes symmetric insertion, i.e. the same string inserted both before and after each hit point. If the calling application needs asymmetric insertion, i.e. different Strings before and after query hits, use the methods setBeforeHits() and setAfterHits() instead.
        Parameters:
        markup - The string that will be used to both prefix and suffix query hits
      • getFieldContent

        public boolean getFieldContent()
        Get whether the field's content should be retrieved.
      • setFieldContent

        public void setFieldContent​(boolean fetchContent)
        Set whether the field's content should be retrieved.

        In order to only get the size of the data in the field, set this property to false. You will be able to access the size via the TdbField.getFieldSize() method, even if the TdbField object in question does not contain the actual value.

        This property is ignored unless the TRIPsystem version used is 6.2-0 or later.

        Setting this property to false also causes the any previously specified summary, focus (KWIC) or extract to be disabled. Assigning false to this property is equal to assigning TdbFieldFetchType.NoValue to the FetchType property (the setFetchType setter method).

        Parameters:
        fetchContent - Pass false to disable retrieval of field content.
      • getFieldFetchOption

        public TdbFieldFetchOption getFieldFetchOption()
        Returns the fetch option for the field.
        Returns:
        the TdbFieldFetchOption
      • setFieldFetchOption

        public void setFieldFetchOption​(TdbFieldFetchOption option)
        Assign the fetch option for the field.
        Parameters:
        option - The fetch option to set
      • clear

        public void clear()
        Reset the template to a default state