Qun Wang created SOLR-4374:
------------------------------
Summary: Solr could not support numeric field name in return
Key: SOLR-4374
URL: https://issues.apache.org/jira/browse/SOLR-4374
Project: Solr
Issue Type: Bug
Components: search
Affects Versions: 4.0
Reporter: Qun Wang
Fix For: 4.1.1
When using numeric field name in schema.xml, like <field name="1001"
type="string"...>, it could not be fetched the specific field name by parameter
'fl' from Solr.
such as 'http://localhost:8983/solr/query?q=1001:test&fl=1001', the response
would be like: '"docs""[{"1001":1001,...},...]'
In org.apache.solr.search.ReturnFields.java, it seems this code limited field
name defination could not be pure numbers:
// like getId, but also accepts dashes for legacy fields
String getFieldName(QueryParsing.StrParser sp) {
sp.eatws();
int id_start = sp.pos;
char ch;
if (sp.pos < sp.end && (ch = sp.val.charAt(sp.pos)) != '$' &&
Character.isJavaIdentifierStart(ch)) {
sp.pos++;
while (sp.pos < sp.end) {
ch = sp.val.charAt(sp.pos);
if (!Character.isJavaIdentifierPart(ch) && ch != '.' && ch != '-') {
break;
}
sp.pos++;
}
return sp.val.substring(id_start, sp.pos);
}
return null;
}
Could we replace or remove this check of Character.isJavaIdentifierStart(ch)
for allowing numeric field name defination?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
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]