29
29
30
30
import org .opencms .file .CmsObject ;
31
31
import org .opencms .i18n .CmsEncoder ;
32
+ import org .opencms .i18n .CmsLocaleManager ;
32
33
import org .opencms .jsp .search .config .I_CmsSearchConfigurationCommon ;
33
34
import org .opencms .jsp .search .state .CmsSearchStateCommon ;
34
35
import org .opencms .jsp .search .state .I_CmsSearchStateCommon ;
@@ -52,6 +53,10 @@ public class CmsSearchControllerCommon implements I_CmsSearchControllerCommon {
52
53
private static final String MACRO_VALUE = "value" ;
53
54
/** Site root macro. */
54
55
private static final String MACRO_SITE_ROOT = "site_root" ;
56
+ /** Locale macro. */
57
+ private static final String MACRO_LOCALE = "locale" ;
58
+ /** Query macro. */
59
+ private static final String MACRO_QUERY = "query" ;
55
60
/** Configuration of common search options. */
56
61
private final I_CmsSearchConfigurationCommon m_config ;
57
62
/** State of the common search options. */
@@ -116,13 +121,18 @@ public void addQueryParts(CmsSolrQuery query, CmsObject cms) {
116
121
if ((null != currentSiteRoot ) && !currentSiteRoot .endsWith ("/" )) {
117
122
currentSiteRoot = currentSiteRoot + "/" ;
118
123
}
124
+ String currentLocale = (null == cms
125
+ ? CmsLocaleManager .getDefaultLocale ()
126
+ : cms .getRequestContext ().getLocale ()).toString ();
119
127
Map <String , String []> extraParamsMap = CmsRequestUtil .createParameterMap (
120
128
m_config .getExtraSolrParams (),
121
129
true ,
122
130
null );
123
131
for (String key : extraParamsMap .keySet ()) {
124
132
for (String value : Arrays .asList (extraParamsMap .get (key ))) {
125
133
value = resolveMacro (value , MACRO_SITE_ROOT , currentSiteRoot );
134
+ value = resolveMacro (value , MACRO_LOCALE , currentLocale );
135
+ value = resolveMacro (value , MACRO_QUERY , queryString );
126
136
if (SET_VARIABLES .contains (key )) {
127
137
if (key .equals (CommonParams .FL )) {
128
138
query .setReturnFields (value );
0 commit comments