Solr request does not handle slash

Is the slash "/" a reserved character in solr name names?

I'm having trouble writing a solr sort request that will parse fields containing a slash "/"

When creating an HTTP request to my solr server:

q=*&sort=normal+desc 

Will work but

 q=*&sort=with/slash+desc q=*&sort=with%2Fslash+desc 

Both refused to say: "You cannot use FieldCache for a multi-valued field: using

Each solr file contains two fields int "normal" and "with / slash". With my solr schema indexing fields as such

 ... <field name="normal" type="int" indexed="true" stored="true" required="false" /> <field name="with/slash" type="int" indexed="true" stored="true" required="false" /> ... 

Is there any special way to encode a slash in solr? Or are there other separators that I can use? I already use '-' and "." for other purposes.

+8
lucene solr
source share
3 answers

I just ran into the same problem, and after some experiments it turned out that if you have the field name first, you should avoid it with a backslash in the Solr request (but note that you do not need to do this in the parameter field list, so a search in the search /my/field/name containing my_value is entered in the q field as:

\/my\/field\/name:my_value

I have not tried the sort field, but try this and let us know :)

This is on Solr 4.0.0 alpha.

+6
source share

From the solr wiki file https://wiki.apache.org/solr/SolrQuerySyntax :

Solr 4.0 adds support for regular expressions, which means that now the '/' is a special character and must be escaped when looking for a literal forward slash.

+1
source share

In my case, I needed to look for a slash / with a wild card * , for example:

 +(*/*) +(*2016/17*) 

I tried to run like this:

 +(*2016\/*) +(*2016\/17*) 

but that didn't work either.

the solution was to wrap the text with a double quote " , for example do:

 +("*\/*") +("*/*") +("*2016\/17*") +("*2016/17*") 

both returned the same result with and without slash escaping

-one
source share

All Articles