Record Class FieldName

java.lang.Object
java.lang.Record
org.alfresco.repo.search.impl.elasticsearch.model.FieldName
Record Components:
raw - The raw property name - e.g. cm:content, PATH

public record FieldName(String raw) extends Record
The various names of a property stored in different ways in Elasticsearch.
  • Constructor Details

    • FieldName

      public FieldName(PropertyDefinition propertyDefinition)
    • FieldName

      public FieldName(String raw)
      Creates an instance of a FieldName record class.
      Parameters:
      raw - the value for the raw record component
  • Method Details

    • fromExactTermSearch

      public static FieldName fromExactTermSearch(String name)
      Create a new FieldName from the exact term version.
      Parameters:
      name - The exact term search field - e.g. cm%3Acontent_exact
      Returns:
      The new FieldName.
    • fromUntokenized

      public static FieldName fromUntokenized(String name)
      Create a new FieldName from the untokenized version.
      Parameters:
      name - The untokenized version of the property - e.g. cm%3Aname_untokenized, ASPECT_untokenized
      Returns:
      The new FieldName.
    • fromLucene

      public static FieldName fromLucene(String name, NamespaceDAO namespaceDAO)
      Create a FieldName from a Lucene property name.
      Parameters:
      name - The lucene property name - for example @cm:name, @{http://www.alfresco.org/model/content/1.0}title
      namespaceDAO - The namespace DAO used to find the prefix for the property.
      Returns:
      The new FieldName.
    • encoded

      public String encoded()
      Generate the encoded format of the property name.
      Returns:
      The encoded property name - e.g. cm%3Acontent, PATH
    • untokenized

      public String untokenized()
      Generate the ES untokenized version of the property name.
      Returns:
      The untokenized property name - e.g. cm%3Acontent_untokenized, ASPECT_untokenized
    • exactTermSearch

      public String exactTermSearch()
      Generate the ES exact term search format of the property name.
      Returns:
      The exact term search field - e.g. cm%3Acontent_exact
    • truncated

      public String truncated()
      Generate the truncated format of the field name.
      Returns:
      The truncated name - e.g. cm:content, ...ty_with_insanely_long_name_for_testing_purposes
    • isUntokenized

      public static boolean isUntokenized(String nameWithUnknownFormat)
      Check if a property is an ES untokenized field.
      Parameters:
      nameWithUnknownFormat - The property name to check.
      Returns:
      true if the name ends with the untokenized suffix.
    • isExactTermSearch

      public static boolean isExactTermSearch(String nameWithUnknownFormat)
      Check if a property is an ES exact term field.
      Parameters:
      nameWithUnknownFormat - The property name to check.
      Returns:
      true if the name ends with the exact term suffix.
    • encoded

      public static String encoded(String name)
      Convert a raw property name to an encoded format.
      Parameters:
      name - The raw property name - e.g. cm:content, PATH
      Returns:
      The encoded property name - e.g. cm%3Acontent, PATH
    • untokenized

      public static String untokenized(String name)
      Convert a raw property name to the ES untokenized property name.
      Parameters:
      name - The raw property name - e.g. cm:content, ASPECT
      Returns:
      The untokenized property name - e.g. cm%3Acontent_untokenized, ASPECT_untokenized
    • exactTermSearch

      public static String exactTermSearch(String name)
      Convert a raw property name to the ES exact term search property name.
      Parameters:
      name - The raw property name - e.g. cm:content
      Returns:
      The exact term search field - e.g. cm%3Acontent_exact
    • truncated

      public static String truncated(String name)
      Create the truncated format of the field name.
      Parameters:
      name - A property name - e.g. cm:content, cm:property_with_insanely_long_name_for_testing_purposes
      Returns:
      The truncated name - e.g. cm:content, ...ty_with_insanely_long_name_for_testing_purposes
    • decode

      public static String decode(String name)
      Convert an encoded property name to the raw name.
      Parameters:
      name - The encoded property name - e.g. cm%3Aname, PATH
      Returns:
      The raw name - e.g. cm:name, PATH
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • raw

      public String raw()
      Returns the value of the raw record component.
      Returns:
      the value of the raw record component