Description
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""[
,...]'
In org.apache.solr.search.ReturnFields.java, it seems this code limited field name defination could not be pure numbers:
org.apache.solr.search.ReturnFields.java
// 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?