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, postingsFormat, queryAnalyzer, similarity, trueProperties, typeName
BINARY, INDEXED, MULTIVALUED, OMIT_NORMS, OMIT_POSITIONS, OMIT_TF_POSITIONS, REQUIRED, SORT_MISSING_FIRST, SORT_MISSING_LAST, STORE_OFFSETS, STORE_TERMOFFSETS, STORE_TERMPOSITIONS, STORE_TERMVECTORS, STORED, TOKENIZED
Constructor and Description |
---|
CurrencyField() |
Modifier and Type | Method and Description |
---|---|
void |
checkSchemaField(SchemaField field)
Check's
SchemaField instances constructed
using this field type to ensure that they are valid. |
IndexableField[] |
createFields(SchemaField field,
Object externalVal,
float boost)
Given a
SchemaField , create one or more IndexableField 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 IndexableField instance for a single value, via the
FieldType.createFields(org.apache.solr.schema.SchemaField, Object, float) method. |
void |
write(TextResponseWriter writer,
String name,
IndexableField field)
calls back to TextResponseWriter to write the field value
|
void |
write(XMLWriter xmlWriter,
String name,
IndexableField field) |
createField, createField, getAnalyzer, getArg, getIndexOptions, getPostingsFormat, getQueryAnalyzer, getSimilarity, getStringSort, getTypeName, getValueSource, hasProperty, indexedToReadable, indexedToReadable, isMultiValued, isTokenized, multiValuedFieldCache, readableToIndexed, readableToIndexed, restrictProps, setAnalyzer, setQueryAnalyzer, setSimilarity, storedToIndexed, storedToReadable, toExternal, toInternal, toObject, 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, Object, 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, Object, float)
method may return more than one fieldpublic void checkSchemaField(SchemaField field) throws SolrException
FieldType
SchemaField
instances constructed
using this field type to ensure that they are valid.
This method is called by the SchemaField
constructor to
check that it's initialization does not violate any fundemental
requirements of the FieldType
. The default implementation
does nothing, but subclasses may chose to throw a SolrException
if invariants are violated by the SchemaField.
checkSchemaField
in class FieldType
SolrException
public IndexableField[] createFields(SchemaField field, Object externalVal, float boost)
FieldType
SchemaField
, create one or more IndexableField
instancescreateFields
in class FieldType
field
- the SchemaField
externalVal
- The value to add to the fieldboost
- The boost to applyIndexableField
FieldType.createField(SchemaField, Object, 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 notpublic 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, IndexableField field) throws IOException
IOException
public void write(TextResponseWriter writer, String name, IndexableField field) throws IOException
FieldType
write
in class FieldType
IOException
public ExchangeRateProvider getProvider()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.