[
https://issues.apache.org/jira/browse/SOLR-3595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414815#comment-13414815
]
Erick Erickson commented on SOLR-3595:
--------------------------------------
This can be done pretty easily by overriding isMultiValued in CurrencyField and
hard-coding returning false. Seems a little harsh and is confusing. I can
define a field with multiValued="true" and then get an error saying "multiple
values encountered for non multiValued field....." Huh?.
One way to handle this would be to also provide a default method in FieldType,
something about "getNonMultivaluedMsg()" (what a bad name!) and overriding that
too. Kludgy but minimal code.
We can also just change the test around line 241 in DocumentBuilder to check
for isPolyField, but I'd have to wash my hands afterward...
replace
if( sfield!=null && !sfield.multiValued() && field.getValueCount() > 1 ) {
with
if( sfield!=null && (!sfield.multiValued() || sfield.isPolyField()) &&
field.getValueCount() > 1 ) {
This kind of awful hack would probably be really bad for polygons in spatial,
but I haven't looked.
I'd prefer to "fail early, fail often" and catch this when the schema file was
being parsed, but I don't see a convenient place to do that. Am I overlooking
the obvious again?
Or is there another way to approach this altogether?
> Currency types do not support range queries when multiValued
> ------------------------------------------------------------
>
> Key: SOLR-3595
> URL: https://issues.apache.org/jira/browse/SOLR-3595
> Project: Solr
> Issue Type: Bug
> Components: Schema and Analysis
> Affects Versions: 4.0-ALPHA
> Reporter: Erick Erickson
> Priority: Minor
> Labels: CurrencyField
> Fix For: 4.0
>
>
> You can define the currency type as multiValued. However, if you do (and have
> more than one value), range queries, at least, do not work. See the thread
> titled "Filtering a query by range returning unexpected results".
> I'm not at all sure that currency type _should_ support multivalued. For
> instance, how would one handle storing multiple values for a currency type in
> different currencies (e.g. USD and EUR)? I don't know enough about the
> internals to understand if it's possible, this JIRA is the result of a
> question on the users list.
> If we decide that currency should _not_ support multiValued, it seems a check
> at startup is in order on the "fail early, fail loudly" principle.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]