@Test public void withFieldAliasesWhenNoMultilingualFields() { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("qf", "title^0.4 comment^0.40 date^1.0"); parameters.put("xwiki.supportedLocales", "en, ro"); SolrParams paramsWithAliases = plugin.withFieldAliases("title:text", new MapSolrParams(parameters)); assertEquals(2, paramsWithAliases.toNamedList().size()); assertEquals("title^0.4 comment^0.40 date^1.0", paramsWithAliases.get("qf")); assertEquals("en, ro", paramsWithAliases.get("xwiki.supportedLocales")); }
public SolrParams withFieldAliases(String query, SolrParams parameters) { Set<String> fieldNames = extractFieldNames(query); String defaultQueryFields = parameters.get("qf"); if (defaultQueryFields != null) { fieldNames.addAll(SolrPluginUtils.parseFieldBoosts(defaultQueryFields).keySet()); } if (fieldNames.isEmpty()) { return parameters; } Map<String, String> aliasParameters = new HashMap<String, String>(); addMultilingualFieldAliases(fieldNames, aliasParameters, parameters); addTypedDynamicFieldAliases(fieldNames, aliasParameters, parameters); return aliasParameters.isEmpty() ? parameters : SolrParams.wrapDefaults(new MapSolrParams(aliasParameters), parameters); }
XWikiDismaxQParserPlugin extends ExtendedDismaxQParserPlugin { public SolrParams withFieldAliases(String query, SolrParams parameters) { Set<String> fieldNames = extractFieldNames(query); String defaultQueryFields = parameters.get("qf"); if (defaultQueryFields != null) { fieldNames.addAll(SolrPluginUtils.parseFieldBoosts(defaultQueryFields).keySet()); } if (fieldNames.isEmpty()) { return parameters; } Map<String, String> aliasParameters = new HashMap<String, String>(); addMultilingualFieldAliases(fieldNames, aliasParameters, parameters); addTypedDynamicFieldAliases(fieldNames, aliasParameters, parameters); return aliasParameters.isEmpty() ? parameters : SolrParams.wrapDefaults(new MapSolrParams(aliasParameters), parameters); } }
XWikiDismaxQParserPlugin extends ExtendedDismaxQParserPlugin { public SolrParams withFieldAliases(String query, SolrParams parameters) { Set<String> fieldNames = extractFieldNames(query); String defaultQueryFields = parameters.get("qf"); if (defaultQueryFields != null) { fieldNames.addAll(SolrPluginUtils.parseFieldBoosts(defaultQueryFields).keySet()); } if (fieldNames.isEmpty()) { return parameters; } Map<String, String> aliasParameters = new HashMap<String, String>(); addMultilingualFieldAliases(fieldNames, aliasParameters, parameters); addTypedDynamicFieldAliases(fieldNames, aliasParameters, parameters); return aliasParameters.isEmpty() ? parameters : SolrParams.wrapDefaults(new MapSolrParams(aliasParameters), parameters); }  }
XWikiDismaxQParserPlugin extends ExtendedDismaxQParserPlugin { public SolrParams withFieldAliases(String query, SolrParams parameters) { Set<String> fieldNames = extractFieldNames(query); String defaultQueryFields = parameters.get("qf"); if (defaultQueryFields != null) { fieldNames.addAll(SolrPluginUtils.parseFieldBoosts(defaultQueryFields).keySet()); } if (fieldNames.isEmpty()) { return parameters; } Map<String, String> aliasParameters = new HashMap<String, String>(); addMultilingualFieldAliases(fieldNames, aliasParameters, parameters); addTypedDynamicFieldAliases(fieldNames, aliasParameters, parameters); return aliasParameters.isEmpty() ? parameters : SolrParams.wrapDefaults(new MapSolrParams(aliasParameters), parameters); }  @Override QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req); SolrParams withFieldAliases(String query, SolrParams parameters); Set<String> extractFieldNames(String query); }
XWikiDismaxQParserPlugin extends ExtendedDismaxQParserPlugin { public SolrParams withFieldAliases(String query, SolrParams parameters) { Set<String> fieldNames = extractFieldNames(query); String defaultQueryFields = parameters.get("qf"); if (defaultQueryFields != null) { fieldNames.addAll(SolrPluginUtils.parseFieldBoosts(defaultQueryFields).keySet()); } if (fieldNames.isEmpty()) { return parameters; } Map<String, String> aliasParameters = new HashMap<String, String>(); addMultilingualFieldAliases(fieldNames, aliasParameters, parameters); addTypedDynamicFieldAliases(fieldNames, aliasParameters, parameters); return aliasParameters.isEmpty() ? parameters : SolrParams.wrapDefaults(new MapSolrParams(aliasParameters), parameters); }  @Override QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req); SolrParams withFieldAliases(String query, SolrParams parameters); Set<String> extractFieldNames(String query);  }