public class CurrencyField extends FieldType implements SchemaAware, ResourceLoaderAware
FieldType.DefaultAnalyzer
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_DEFAULT_CURRENCY |
protected static String |
DEFAULT_PRECISION_STEP |
protected static String |
DEFAULT_RATE_PROVIDER_CLASS |
protected static String |
FIELD_SUFFIX_AMOUNT_RAW |
protected static String |
FIELD_SUFFIX_CURRENCY |
protected FieldType |
fieldTypeAmountRaw |
protected FieldType |
fieldTypeCurrency |
static org.slf4j.Logger |
log |
protected static String |
PARAM_DEFAULT_CURRENCY |
protected static Object |
PARAM_PRECISION_STEP |
protected static String |
PARAM_RATE_PROVIDER_CLASS |
analyzer, args, falseProperties, POLY_FIELD_SEPARATOR, queryAnalyzer, trueProperties, typeName
BINARY, INDEXED, MULTIVALUED, OMIT_NORMS, OMIT_POSITIONS, OMIT_TF_POSITIONS, REQUIRED, SORT_MISSING_FIRST, SORT_MISSING_LAST, STORE_TERMOFFSETS, STORE_TERMPOSITIONS, STORE_TERMVECTORS, STORED, TOKENIZED
Constructor and Description |
---|
CurrencyField() |
Modifier and Type | Method and Description |
---|---|
Fieldable[] |
createFields(SchemaField field,
String externalVal,
float boost)
Given a
SchemaField , create one or more Fieldable instances |
Query |
getFieldQuery(QParser parser,
SchemaField field,
String externalVal)
Returns a Query instance for doing searches against a field.
|
ExchangeRateProvider |
getProvider() |
Query |
getRangeQuery(QParser parser,
SchemaField field,
org.apache.solr.schema.CurrencyValue p1,
org.apache.solr.schema.CurrencyValue p2,
boolean minInclusive,
boolean maxInclusive) |
Query |
getRangeQuery(QParser parser,
SchemaField field,
String part1,
String part2,
boolean minInclusive,
boolean maxInclusive)
Returns a Query instance for doing range searches on this field type.
|
SortField |
getSortField(SchemaField field,
boolean reverse)
Returns the SortField instance that should be used to sort fields
of this type.
|
void |
inform(IndexSchema indexSchema)
When index schema is informed, add dynamic fields.
|
void |
inform(ResourceLoader resourceLoader)
Load the currency config when resource loader initialized.
|
protected void |
init(IndexSchema schema,
Map<String,String> args)
subclasses should initialize themselves with the args provided
and remove valid arguments.
|
boolean |
isPolyField()
A "polyField" is a FieldType that can produce more than one Fieldable instance for a single value, via the
FieldType.createFields(org.apache.solr.schema.SchemaField, String, float) method. |
void |
write(TextResponseWriter writer,
String name,
Fieldable field)
calls back to TextResponseWriter to write the field value
|
void |
write(XMLWriter xmlWriter,
String name,
Fieldable field)
Renders the specified field as XML
|
createField, createField, getAnalyzer, getArg, getFieldIndex, getFieldStore, getFieldTermVec, getIndexOptions, getQueryAnalyzer, getStringSort, getTypeName, getValueSource, getValueSource, hasProperty, indexedToReadable, isMultiValued, isTokenized, multiValuedFieldCache, readableToIndexed, restrictProps, setAnalyzer, setQueryAnalyzer, storedToIndexed, storedToReadable, toExternal, toInternal, toObject, toString
protected static final String PARAM_DEFAULT_CURRENCY
protected static final String PARAM_RATE_PROVIDER_CLASS
protected static final Object PARAM_PRECISION_STEP
protected static final String DEFAULT_RATE_PROVIDER_CLASS
protected static final String DEFAULT_DEFAULT_CURRENCY
protected static final String DEFAULT_PRECISION_STEP
protected static final String FIELD_SUFFIX_AMOUNT_RAW
protected static final String FIELD_SUFFIX_CURRENCY
protected FieldType fieldTypeCurrency
protected FieldType fieldTypeAmountRaw
public static org.slf4j.Logger log
protected void init(IndexSchema schema, Map<String,String> args)
FieldType
public boolean isPolyField()
FieldType
FieldType.createFields(org.apache.solr.schema.SchemaField, String, float)
method. This is useful
when hiding the implementation details of a field from the Solr end user. For instance, a spatial point may be represented by multiple different fields.isPolyField
in class FieldType
FieldType.createFields(org.apache.solr.schema.SchemaField, String, float)
method may return more than one fieldpublic Fieldable[] createFields(SchemaField field, String externalVal, float boost)
FieldType
SchemaField
, create one or more Fieldable
instancescreateFields
in class FieldType
field
- the SchemaField
externalVal
- The value to add to the fieldboost
- The boost to applyFieldable
FieldType.createField(SchemaField, String, float)
,
FieldType.isPolyField()
public void inform(IndexSchema indexSchema)
inform
in interface SchemaAware
indexSchema
- The index schema.public void inform(ResourceLoader resourceLoader)
inform
in interface ResourceLoaderAware
resourceLoader
- The resource loader.public Query getFieldQuery(QParser parser, SchemaField field, String externalVal)
FieldType
getFieldQuery
in class FieldType
parser
- The QParser
calling the methodfield
- The SchemaField
of the field to searchexternalVal
- The String representation of the value to searchQuery
instance. This implementation returns a TermQuery
but overriding queries may notpublic Query getRangeQuery(QParser parser, SchemaField field, String part1, String part2, boolean minInclusive, boolean maxInclusive)
FieldType
SolrQueryParser
currently passes part1 and part2 as null if they are '*' respectively. minInclusive and maxInclusive are both true
currently by SolrQueryParser but that may change in the future. Also, other QueryParser implementations may have
different semantics.
Sub-classes should override this method to provide their own range query implementation. They should strive to
handle nulls in part1 and/or part2 as well as unequal minInclusive and maxInclusive parameters gracefully.getRangeQuery
in class FieldType
field
- the schema fieldpart1
- the lower boundary of the range, nulls are allowed.part2
- the upper boundary of the range, nulls are allowedminInclusive
- whether the minimum of the range is inclusive or notmaxInclusive
- whether the maximum of the range is inclusive or notSolrQueryParser.getRangeQuery(String, String, String, boolean)
public Query getRangeQuery(QParser parser, SchemaField field, org.apache.solr.schema.CurrencyValue p1, org.apache.solr.schema.CurrencyValue p2, boolean minInclusive, boolean maxInclusive)
public SortField getSortField(SchemaField field, boolean reverse)
FieldType
getSortField
in class FieldType
SchemaField.checkSortability()
public void write(XMLWriter xmlWriter, String name, Fieldable field) throws IOException
FieldType
write
in class FieldType
IOException
public void write(TextResponseWriter writer, String name, Fieldable field) throws IOException
FieldType
write
in class FieldType
IOException
public ExchangeRateProvider getProvider()