0

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?

NeatNerd
  • 2,305
  • 3
  • 26
  • 49

1 Answers1

0

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.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • 1
    i have submitted the fl in the request without $ sign, it was added in exception by Solr. This would work indeed, but if you add another parameter with $ sign after this it fails to display any fields, i.e. if fl in request is name, $foo1, $foo2 then response will return documents, but with no fields. – NeatNerd Aug 27 '14 at 11:48