Solr UTF8, + () - , , ..
:
Space => +
+ => %2B
( => %28
) => %29
.., URL- - SOLR:
https://wiki.apache.org/solr/SolrQuerySyntax
Try:
str_replace(array('+','(',')',' '), array('%2B','%28','%29','+'), '+field1:* (field2:1 field2:10) -(field3:value1 field3:value2)');
:
%2Bfield1:*+%2B%28field2:1+field2:10%29+-%28field3:value1+field3:value2%29
OR, OR.
The above result is far from clean and readable, but it is a correctly formatted UTF8 string that Solr requires you to pass. You will notice the difference as soon as you run it.
Why str_replace instead of urlencode? Well, you can use urlencode because it will format the string correctly as UTF8, but it can format some string components that don't need to be encoded.
source
share