gt: 					_log.debug(entry.getKey() + ":" + entry.getValue());
context: 
  package fi.soveltia.liferay.gsearch.core.impl.query.context;
  
  import com.liferay.portal.kernel.json.JSONArray;
  import com.liferay.portal.kernel.model.User;
  import com.liferay.portal.kernel.security.auth.http.HttpAuthManagerUtil;
  import com.liferay.portal.kernel.service.UserLocalService;
  import com.liferay.portal.kernel.theme.ThemeDisplay;
  import com.liferay.portal.kernel.util.StringBundler;
  import com.liferay.portal.kernel.util.Validator;
  import com.liferay.portal.kernel.util.WebKeys;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Locale;
  import java.util.Map;
  import java.util.Map.Entry;
  
  import javax.portlet.PortletRequest;
  import javax.servlet.http.HttpServletRequest;
  
  import org.apache.commons.lang3.StringUtils;
  import org.osgi.service.component.annotations.Component;
  import org.osgi.service.component.annotations.Reference;
  import org.osgi.service.component.annotations.ReferenceCardinality;
  import org.osgi.service.component.annotations.ReferencePolicy;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import fi.soveltia.liferay.gsearch.core.api.configuration.CoreConfigurationHelper;
  import fi.soveltia.liferay.gsearch.core.api.constants.ConfigurationNames;
  import fi.soveltia.liferay.gsearch.core.api.constants.ParameterNames;
  import fi.soveltia.liferay.gsearch.core.api.params.ParameterBuilder;
  import fi.soveltia.liferay.gsearch.core.api.query.context.QueryContext;
  import fi.soveltia.liferay.gsearch.core.api.query.context.QueryContextBuilder;
  import fi.soveltia.liferay.gsearch.core.api.query.context.contributor.QueryContextContributor;
  import fi.soveltia.liferay.gsearch.core.impl.util.GSearchUtil;
  
  /**
   * Query params builder implementation.
   *
   * @author Petteri Karttunen
   */
  @Component(
  	immediate = true, 
  	service = QueryContextBuilder.class
  )
  public class QueryContextBuilderImpl implements QueryContextBuilder {
  
  	/**
  	 * {@inheritDoc}
  	 */
  	@Override
  	public QueryContext buildQueryContext(
  			HttpServletRequest httpServletRequest,
  			Locale locale, String keywords)
  		throws Exception {
  
  		QueryContext queryContext = new QueryContext();
  		
  		setBasicParameters(httpServletRequest, queryContext, locale, keywords);
  
  		return queryContext;
  	}
  
  	/**
  	 * {@inheritDoc}
  	 */
  	@Override
  	public QueryContext buildQueryContext(
  			HttpServletRequest httpServletRequest, Locale locale, JSONArray filterConfiguration,
  			JSONArray clauseConfiguration, JSONArray facetConfiguration,
  			JSONArray sortConfiguration, JSONArray suggesterConfiguration,
  			JSONArray rescorerConfiguration, String keywords)
  		throws Exception {
  
  		QueryContext queryContext = new QueryContext();
  
  		setBasicParameters(httpServletRequest, queryContext, locale, keywords);
  
  		if (filterConfiguration == null) {
  			filterConfiguration = _coreConfigurationHelper.getFilters();
  		}
  
  		queryContext.setConfiguration(
  			ConfigurationNames.FILTER, filterConfiguration);
  
  		if (clauseConfiguration == null) {
  			clauseConfiguration = _coreConfigurationHelper.getClauses();
  		}
  
  		queryContext.setConfiguration(
  			ConfigurationNames.CLAUSE, clauseConfiguration);
  
  		if (facetConfiguration == null) {
  			facetConfiguration = _coreConfigurationHelper.getFacets();
  		}
  
  		queryContext.setConfiguration(
  			ConfigurationNames.FACET, facetConfiguration);
  
  		if (sortConfiguration == null) {
  			sortConfiguration = _coreConfigurationHelper.getSorts();
  		}
  
  		queryContext.setConfiguration(
  				ConfigurationNames.SORT, sortConfiguration);
  
  		if (rescorerConfiguration == null) {
  			rescorerConfiguration = _coreConfigurationHelper.getRescoreClauses();
  		}
  
  		queryContext.setConfiguration(
  				ConfigurationNames.RESCORE, rescorerConfiguration);
  
  		if (suggesterConfiguration == null) {
  			suggesterConfiguration =
  				_coreConfigurationHelper.getKeywordSuggesters();
  		}
  
  		queryContext.setConfiguration(
  			ConfigurationNames.SUGGESTER, suggesterConfiguration);
  
  		return queryContext;
  	}
  
  	/**
  	 * {@inheritDoc}
  	 */
  	@Override
  	public QueryContext buildSuggesterQueryContext(
  			HttpServletRequest httpServletRequest,
  			JSONArray suggesterConfiguration, long groupId,
  			Locale locale, String keywords)
  		throws Exception {
  
  		QueryContext queryContext = new QueryContext();
  
  		setBasicParameters(httpServletRequest, queryContext, locale, keywords);
  
  		if (suggesterConfiguration == null) {
  			queryContext.setConfiguration(
  				ConfigurationNames.SUGGESTER,
  				_coreConfigurationHelper.getKeywordSuggesters());
  		}
  
  		queryContext.setParameter(ParameterNames.GROUP_ID, groupId);
  
  		return queryContext;
  	}
  
  	/**
  	 * {@inheritDoc}
  	 */
  	@Override
  	public void parseParameters(QueryContext queryContext) throws Exception {
  
  		// Run parameter builders
  
  		if (_parameterBuilders == null) {
  			throw new RuntimeException("No parameter builders available.");
  		}
  
  		for (ParameterBuilder parameterBuilder : _parameterBuilders) {
  			if (parameterBuilder.validate(queryContext)) {
  				parameterBuilder.addParameter(queryContext);
  			}
  		}
  	}
  
  	/**
  	 * {@inheritDoc}
  	 */
  	@Override
  	public void parseParametersHeadless(
  			QueryContext queryContext, Map<String, Object> parameterMap)
  		throws Exception {
  
  		// Run parameter builders
  
  		if (_parameterBuilders == null) {
  			throw new RuntimeException("No parameter builders available.");
  		}
  
  		if (parameterMap == null) {
  			return;
  		}
  
  		for (ParameterBuilder parameterBuilder : _parameterBuilders) {
  			if (parameterBuilder.validateHeadless(queryContext, parameterMap)) {
  				parameterBuilder.addParameterHeadless(queryContext, parameterMap);
  			}
  		}
  	}
  	
  	@Override
  	public void processQueryContextContributor(QueryContext queryContext, String name)
  			throws Exception {
  		
  		for (QueryContextContributor queryContextContributor : _queryContextContributors) {
  			if (queryContextContributor.getName().equals(name)) {
  				queryContextContributor.contribute(queryContext);
  			}
  		}
  	}
  
  	@Override
  	public void processQueryContextContributors(QueryContext queryContext)
  			throws Exception {
  
  		for (QueryContextContributor queryContextContributor : _queryContextContributors) {
  			queryContextContributor.contribute(queryContext);
  		}
  		
  		if (_log.isDebugEnabled()) {
  
  			_log.debug("Configuration variables in the query context:");
  			
  			if (queryContext.getConfigurationVariables() != null) {
  				for (Entry<String, String>entry : queryContext.getConfigurationVariables().entrySet()) {
  