Search code examples
solrsolr4luke

Escape LukeRequest with spaces, slashes, and colon


I am using Solr 4.1. Using LukeRequest, I want to get the number of documents with data for a specific field. The name of the field is something like http://foo.org/bar/ baz (note the space between bar/ and baz). When I visit http://127.0.0.1:8983/root/admin/luke I get a list of all of my fields, including the aforementioned one. When I visit

http://127.0.0.1:8983/root/admin/luke?fl=http://foo.org/bar/ baz

I get no hits. I have tried url-encoding the string, escaping slashes, escaping the colon, escaping the space, using + instead of space, and every possible combination of backslashes I can think of. The solution posted at another StackOverflow question field listing in solr with "fl" parameter for a field having space in between didn't work for me.

I am really only looking for a yes-no answer to whether any documents have a value for this particular field, so if there is a better way to do this than LukeRequest, I'm all ears for that too.


Solution

  • AFAIK, escaping special characters using a backslash works for values, not for parameters like fl or sort.

    This answer on lucene mailing list also confirms my thoughts. I guess you shouldn't have spaces in field names.