Class CurrencyFieldType

    • Constructor Detail

      • CurrencyFieldType

        public CurrencyFieldType()
    • Method Detail

      • getCurrency

        public static Currency getCurrency​(String code)
        A wrapper around Currency.getInstance that returns null instead of throwing IllegalArgumentException if the specified Currency does not exist in this JVM.
        See Also:
      • getDefaultCurrency

        public String getDefaultCurrency()
        The identifier code for the default currency of this field type
      • init

        protected void init​(IndexSchema schema,
                            Map<String,​String> args)
        Description copied from class: FieldType
        subclasses should initialize themselves with the args provided and remove valid arguments. leftover arguments will cause an exception. Common boolean properties have already been handled.
        init in class FieldType
      • checkSchemaField

        public void checkSchemaField​(SchemaField field)
                              throws SolrException
        Description copied from class: FieldType
        Check's SchemaField instances constructed using this field type to ensure that they are valid.

        This method is called by the SchemaField constructor to check that its initialization does not violate any fundamental requirements of the FieldType. Subclasses may choose to throw a SolrException if invariants are violated by the SchemaField.

        checkSchemaField in class FieldType
      • inform

        public void inform​(IndexSchema schema)
        When index schema is informed, get field types for the configured dynamic sub-fields Informs the IndexSchema provided by the schema parameter of an event (e.g., a new FieldType was added, etc.
        Specified by:
        inform in interface SchemaAware
        schema - The IndexSchema instance that inform of the update to.
      • inform

        public void inform​(org.apache.lucene.analysis.util.ResourceLoader resourceLoader)
        Load the currency config when resource loader initialized.
        Specified by:
        inform in interface org.apache.lucene.analysis.util.ResourceLoaderAware
        resourceLoader - The resource loader.
      • getFieldQuery

        public getFieldQuery​(QParser parser,
                                                            SchemaField field,
                                                            String externalVal)
        Description copied from class: FieldType
        Returns a Query instance for doing searches against a field.
        getFieldQuery in class FieldType
        parser - The QParser calling the method
        field - The SchemaField of the field to search
        externalVal - The String representation of the value to search
        The Query instance. This implementation returns a TermQuery but overriding queries may not
      • getConvertedValueSource

        public org.apache.lucene.queries.function.ValueSource getConvertedValueSource​(String targetCurrencyCode,
                                                                                      org.apache.solr.schema.CurrencyFieldType.RawCurrencyValueSource source)

        Returns a ValueSource over this field in which the numeric value for each document represents the value from the underlying RawCurrencyValueSource as converted to the specified target Currency.

        For example: If the targetCurrencyCode param is set to USD, then the values returned by this value source would represent the equivalent number of dollars after converting each document's raw value to USD. So for a document whose indexed value was currently equivalent to "5.43,USD" using the the exchange provider for this field, this ValueSource would return a value of "5.43"

        targetCurrencyCode - The target currency for the resulting value source, if null the defaultCurrency for this field type will be used
        source - the raw ValueSource to wrap
        See Also:
        PARAM_DEFAULT_CURRENCY, DEFAULT_DEFAULT_CURRENCY, getValueSource(org.apache.solr.schema.SchemaField,
      • getRangeQuery

        public getRangeQuery​(QParser parser,
                                                            SchemaField field,
                                                            String part1,
                                                            String part2,
                                                            boolean minInclusive,
                                                            boolean maxInclusive)
        Description copied from class: FieldType
        Returns a Query instance for doing range searches on this field type. 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
        parser - the QParser calling the method
        field - the schema field
        part1 - the lower boundary of the range, nulls are allowed.
        part2 - the upper boundary of the range, nulls are allowed
        minInclusive - whether the minimum of the range is inclusive or not
        maxInclusive - whether the maximum of the range is inclusive or not
        a Query instance to perform range search according to given parameters
      • getUninversionType

        public UninvertingReader.Type getUninversionType​(SchemaField sf)
        Description copied from class: FieldType

        If DocValues is not enabled for a field, but it's indexed, docvalues can be constructed on the fly (uninverted, aka fieldcache) on the first request to sort, facet, etc. This specifies the structure to use.

        This method will not be used if the field is (effectively) uninvertible="false"

        Specified by:
        getUninversionType in class FieldType
        sf - field instance
        type to uninvert, or null (to disallow uninversion for the field)
        See Also: