How can colons in Solr field names be escaped for the "fl" parameter?

1.1k Views Asked by At

I used the colon character to namespace field names in my Solr schema. We need to use a namespacing character because we have hundreds of fields from different sources. Using an underscore is not possible because this is used within subnames.

The issue seems to be that when Solr sees the colon, it triggers pseudo field parsing (see SOLR-2444). For the field tika:metadata:height, Solr then returns a 400 error with the message:

undefined field: "metadata"

I can't seem to find any way to escape the : character. Has anyone found one?

Escaping with a backslash doesn't work.

I'm using the SolrJ Java client.

1

There are 1 best solutions below

2
On

Its Syntax error as well, with message - Cannot parse tika:metadata:height

You can escape : using \ like \:

But in your its showing undefined field: "metadata" that means metadata field is not defined in your schema.xml file, so check on that.

on correcting error and syntax, your query request tika:metadata\:height will search for string value "metadata:height" in field name "tika"

Tokenization

Example:

q=\:title

Also because of query tokenization :colon is discarded, if you have used solr.StandardTokenizerFactory

though : is escaped, parsedquery will become as q=title .

Try with solr.WhitespaceTokenizerFactory