Package org.apache.solr.search
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrReturnFields.FIELD_SOURCES
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_wantsAllFields
protected boolean
_wantsScore
protected Map<String,String>
renameFields
static String
SCORE
protected DocTransformer
transformer
-
Constructor Summary
Constructors Constructor Description SolrReturnFields()
SolrReturnFields(String[] fl, SolrQueryRequest req)
SolrReturnFields(String fl, SolrQueryRequest req)
SolrReturnFields(SolrQueryRequest req)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getExplicitlyRequestedFieldNames()
The explicitly requested field names (includes pseudo fields)org.apache.solr.search.SolrDocumentFetcher.RetrieveFieldsOptimizer
getFetchOptimizer(Supplier<org.apache.solr.search.SolrDocumentFetcher.RetrieveFieldsOptimizer> supplier)
static String
getFieldName(StrParser sp)
Map<String,String>
getFieldRenames()
Get the fields which have been renamedSolrReturnFields.FIELD_SOURCES
getFieldSources()
Set<String>
getLuceneFieldNames()
Set of field names with their exact names from the lucene index.Set<String>
getLuceneFieldNames(boolean ignoreWantsAll)
Set of field names with their exact names from the lucene index.Set<String>
getRequestedFieldNames()
The requested field names (includes pseudo fields)DocTransformer
getTransformer()
Returns the DocTransformer used to modify documents, ornull
boolean
hasPatternMatching()
Returnstrue
if the fieldnames should be picked with a patternvoid
setFieldSources(SolrReturnFields.FIELD_SOURCES fieldSources)
String
toString()
boolean
wantsAllFields()
Returnstrue
if all fields should be returned to the external client.boolean
wantsField(String name)
Returnstrue
if the specified field should be returned to the external client -- either using its own name, or via an alias.boolean
wantsScore()
Returnstrue
if the score should be returned.
-
-
-
Field Detail
-
SCORE
public static final String SCORE
- See Also:
- Constant Field Values
-
transformer
protected DocTransformer transformer
-
_wantsScore
protected boolean _wantsScore
-
_wantsAllFields
protected boolean _wantsAllFields
-
-
Constructor Detail
-
SolrReturnFields
public SolrReturnFields()
-
SolrReturnFields
public SolrReturnFields(SolrQueryRequest req)
-
SolrReturnFields
public SolrReturnFields(String fl, SolrQueryRequest req)
-
SolrReturnFields
public SolrReturnFields(String[] fl, SolrQueryRequest req)
-
-
Method Detail
-
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 classReturnFields
- Returns:
- a mapping of renamed fields
-
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 toSolrIndexSearcher.doc(int, Set)
.NOTE: In some situations, this method may return
null
even ifReturnFields.wantsAllFields()
isfalse
. 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 classReturnFields
- 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 classReturnFields
- 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 classReturnFields
- 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 classReturnFields
- Returns:
- Set of explicitly requested field names or
null
(no explict)
-
hasPatternMatching
public boolean hasPatternMatching()
Description copied from class:ReturnFields
Returnstrue
if the fieldnames should be picked with a pattern- Specified by:
hasPatternMatching
in classReturnFields
-
wantsField
public boolean wantsField(String name)
Description copied from class:ReturnFields
Returnstrue
if the specified field should be returned to the external client -- either using its own name, or via an alias. This method returnsfalse
even if the specified name is needed as an "extra" field for use by transformers.- Specified by:
wantsField
in classReturnFields
-
wantsAllFields
public boolean wantsAllFields()
Description copied from class:ReturnFields
Returnstrue
if all fields should be returned to the external client.- Specified by:
wantsAllFields
in classReturnFields
-
wantsScore
public boolean wantsScore()
Description copied from class:ReturnFields
Returnstrue
if the score should be returned.- Specified by:
wantsScore
in classReturnFields
-
getTransformer
public DocTransformer getTransformer()
Description copied from class:ReturnFields
Returns the DocTransformer used to modify documents, ornull
- Specified by:
getTransformer
in classReturnFields
-
-