Class SolrReturnFields

java.lang.Object
org.apache.solr.search.ReturnFields
org.apache.solr.search.SolrReturnFields

public class SolrReturnFields extends ReturnFields
The default implementation of return fields parsing for Solr.
  • Field Details

  • Constructor Details

    • SolrReturnFields

      public SolrReturnFields()
    • SolrReturnFields

      public SolrReturnFields(SolrQueryRequest req)
    • SolrReturnFields

      public SolrReturnFields(String fl, SolrQueryRequest req)
    • SolrReturnFields

      public SolrReturnFields(String[] fl, SolrQueryRequest req)
    • SolrReturnFields

      public SolrReturnFields(Collection<String> plainFields, DocTransformer docTransformer)
      For pre-parsed simple field list with optional transformer. Does not support globs or the score. This constructor is more for internal use; not for parsing user input.
      Parameters:
      plainFields - simple field list; nothing special. If null, equivalent to all-fields.
      docTransformer - optional transformer.
  • Method Details

    • getFieldSources

      public SolrReturnFields.FIELD_SOURCES getFieldSources()
    • setFieldSources

      public void setFieldSources(SolrReturnFields.FIELD_SOURCES fieldSources)
    • getFetchOptimizer

      public org.apache.solr.search.SolrDocumentFetcher.RetrieveFieldsOptimizer getFetchOptimizer(Supplier<org.apache.solr.search.SolrDocumentFetcher.RetrieveFieldsOptimizer> supplier)
    • getFieldRenames

      public Map<String,String> getFieldRenames()
      Description copied from class: ReturnFields
      Get the fields which have been renamed
      Specified by:
      getFieldRenames in class ReturnFields
      Returns:
      a mapping of renamed fields
    • getFieldName

      public static String getFieldName(StrParser sp)
    • getLuceneFieldNames

      public Set<String> getLuceneFieldNames()
      Description copied from class: ReturnFields
      Set of field names with their exact names from the lucene index. Class such as ResponseWriters pass this to SolrDocumentFetcher.doc(int, Set).

      NOTE: In some situations, this method may return null even if ReturnFields.wantsAllFields() is false. For example: When glob expressions are used (ReturnFields.hasPatternMatching()), it is safer to request all field names then to attempt to resolve the globs against all possible dynamic field names in the index.

      Specified by:
      getLuceneFieldNames in class ReturnFields
      Returns:
      Set of field names or null (all fields).
    • getLuceneFieldNames

      public Set<String> getLuceneFieldNames(boolean ignoreWantsAll)
      Description copied from class: ReturnFields
      Set of field names with their exact names from the lucene index.
      Specified by:
      getLuceneFieldNames in class ReturnFields
      Parameters:
      ignoreWantsAll - If true, it returns any additional specified field names, in spite of also wanting all fields. Example: when fl=*,field1, returns ["field1"]. If false, the method returns null when all fields are wanted. Example: when fl=*,field1, returns null. Note that this method returns null regardless of ignoreWantsAll if all fields are requested and no explicit field names are specified.
    • getRequestedFieldNames

      public Set<String> getRequestedFieldNames()
      Description copied from class: ReturnFields
      The requested field names (includes pseudo fields)
      Specified by:
      getRequestedFieldNames in class ReturnFields
      Returns:
      Set of field names or null (all fields).
    • getExplicitlyRequestedFieldNames

      public Set<String> getExplicitlyRequestedFieldNames()
      Description copied from class: ReturnFields
      The explicitly requested field names (includes pseudo fields)
      Specified by:
      getExplicitlyRequestedFieldNames in class ReturnFields
      Returns:
      Set of explicitly requested field names or null (no explict)
    • hasPatternMatching

      public boolean hasPatternMatching()
      Description copied from class: ReturnFields
      Returns true if the fieldnames should be picked with a pattern
      Specified by:
      hasPatternMatching in class ReturnFields
    • wantsField

      public boolean wantsField(String name)
      Description copied from class: ReturnFields
      Returns true if the specified field should be returned to the external client -- either using its own name, or via an alias. This method returns false even if the specified name is needed as an "extra" field for use by transformers.
      Specified by:
      wantsField in class ReturnFields
    • wantsAllFields

      public boolean wantsAllFields()
      Description copied from class: ReturnFields
      Returns true if all fields should be returned to the external client.
      Specified by:
      wantsAllFields in class ReturnFields
    • wantsScore

      public boolean wantsScore()
      Description copied from class: ReturnFields
      Returns true if the score should be returned.
      Specified by:
      wantsScore in class ReturnFields
    • getScoreDependentReturnFields

      public Map<String,String> getScoreDependentReturnFields()
      Description copied from class: ReturnFields
      A mapping of return fields that depend on score and the names they are associated with.
      Specified by:
      getScoreDependentReturnFields in class ReturnFields
      Returns:
      a mapping from return field name to the string representation of its definition
    • getTransformer

      public DocTransformer getTransformer()
      Description copied from class: ReturnFields
      Returns the DocTransformer used to modify documents, or null
      Specified by:
      getTransformer in class ReturnFields
    • toString

      public String toString()
      Overrides:
      toString in class Object