[ https://issues.apache.org/jira/browse/SOLR-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Qun Wang updated SOLR-4374: --------------------------- 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""[{"1001":1001,...},...]' In org.apache.solr.search.ReturnFields.java, it seems this code limited field name defination could not be pure numbers: {code:title=org.apache.solr.search.ReturnFields.java|borderStyle=solid} // 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; } {code} Could we replace or remove this check of Character.isJavaIdentifierStart(ch) for allowing numeric field name defination? was: 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? > 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: > {code:title=org.apache.solr.search.ReturnFields.java|borderStyle=solid} > // 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; > } > {code} > 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: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org