I have an index with $ sign in field names in Solr. Reindexing is not an option. There are functional queries in Solr with $ being variable identifier (See here). When i call a query to retrieve specific fields (fl=$created_dt,name), solr will return an error
Error parsing fieldname: Missing param created_dt while parsing function '$created_dt,$name'
I understand that is because Solr interpret it as a variable. Is there any way to fix it?
In general, as you have discovered, it's a good idea to avoid most symbols in field names in Solr. In particular $ is used to allow for separate arguments in the query string for replacement while parsing (such as foo=$qq&qq=bar
).
There is however a small hack for the fl
-parameter that you can use: if the first field doesn't have a symbol, it should parse OK. If you use fl=name,$created_dt
, it will work (although you might have meant to have $name as well, from the error message you included. If that's the case, use another field name without $). &fl=name,$foo_i
works under 4.9.0 at least.
You might want to plan a migration to more normalized field names in the future.