org.apache.solr.util.SolrPluginUtils Java Examples
The following examples show how to use
org.apache.solr.util.SolrPluginUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DismaxSearchEngineRequestAdapter.java From querqy with Apache License 2.0 | 6 votes |
@Override public Query applyMinimumShouldMatch(final BooleanQuery query) { final List<BooleanClause> clauses = query.clauses(); if (clauses.size() < 2) { return query; } for (final BooleanClause clause : clauses) { if ((clause.getQuery() instanceof BooleanQuery) && (clause.getOccur() != BooleanClause.Occur.MUST)) { return query; // seems to be a complex query with sub queries - do not // apply mm } } return SolrPluginUtils.setMinShouldMatch(query, minShouldMatch); }
Example #2
Source File: ExtendedDismaxQParser.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Extracts all the aliased fields from the requests and adds them to up */ private void addAliasesFromRequest(ExtendedSolrQueryParser up, float tiebreaker) { Iterator<String> it = config.solrParams.getParameterNamesIterator(); while(it.hasNext()) { String param = it.next(); if(param.startsWith("f.") && param.endsWith(".qf")) { // Add the alias String fname = param.substring(2,param.length()-3); String qfReplacement = config.solrParams.get(param); Map<String,Float> parsedQf = SolrPluginUtils.parseFieldBoosts(qfReplacement); if(parsedQf.size() == 0) return; up.addAlias(fname, tiebreaker, parsedQf); } } }
Example #3
Source File: LTRScoringModel.java From lucene-solr with Apache License 2.0 | 6 votes |
@SuppressWarnings({"rawtypes"}) public static LTRScoringModel getInstance(SolrResourceLoader solrResourceLoader, String className, String name, List<Feature> features, List<Normalizer> norms, String featureStoreName, List<Feature> allFeatures, Map<String,Object> params) throws ModelException { final LTRScoringModel model; try { // create an instance of the model model = solrResourceLoader.newInstance( className, LTRScoringModel.class, new String[0], // no sub packages new Class[] { String.class, List.class, List.class, String.class, List.class, Map.class }, new Object[] { name, features, norms, featureStoreName, allFeatures, params }); if (params != null) { SolrPluginUtils.invokeSetters(model, params.entrySet()); } } catch (final Exception e) { throw new ModelException("Model type does not exist " + className, e); } model.validate(); return model; }
Example #4
Source File: SolrMetricReporter.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Initializes a {@link SolrMetricReporter} with the plugin's configuration. * * @param pluginInfo the plugin's configuration */ @SuppressWarnings("unchecked") public void init(PluginInfo pluginInfo) { if (pluginInfo != null) { this.pluginInfo = pluginInfo.copy(); if (this.pluginInfo.initArgs != null) { SolrPluginUtils.invokeSetters(this, this.pluginInfo.initArgs); } } validate(); if (!enabled) { log.info("Reporter disabled for registry {}", registryName); return; } log.debug("Initializing for registry {}", registryName); doInit(); }
Example #5
Source File: MetricSuppliers.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Create a {@link Histogram} supplier. * @param info plugin configuration, or null for default * @return configured supplier instance, or default instance if configuration was invalid */ @SuppressWarnings({"unchecked"}) public static MetricRegistry.MetricSupplier<Histogram> histogramSupplier(SolrResourceLoader loader, PluginInfo info) { MetricRegistry.MetricSupplier<Histogram> supplier; if (info == null || info.className == null || info.className.isEmpty()) { supplier = new DefaultHistogramSupplier(loader); } else { try { supplier = loader.newInstance(info.className, MetricRegistry.MetricSupplier.class); } catch (Exception e) { log.warn("Error creating custom Histogram supplier (will use default): {}", info, e); supplier = new DefaultHistogramSupplier(loader); } } if (supplier instanceof PluginInfoInitialized) { ((PluginInfoInitialized)supplier).init(info); } else { SolrPluginUtils.invokeSetters(supplier, info.initArgs, true); } return supplier; }
Example #6
Source File: MetricSuppliers.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Create a {@link Timer} supplier. * @param loader resource loader * @param info plugin configuration, or null for default * @return configured supplier instance, or default instance if configuration was invalid */ @SuppressWarnings({"unchecked"}) public static MetricRegistry.MetricSupplier<Timer> timerSupplier(SolrResourceLoader loader, PluginInfo info) { MetricRegistry.MetricSupplier<Timer> supplier; if (info == null || info.className == null || info.className.isEmpty()) { supplier = new DefaultTimerSupplier(loader); } else { try { supplier = loader.newInstance(info.className, MetricRegistry.MetricSupplier.class); } catch (Exception e) { log.warn("Error creating custom Timer supplier (will use default): {}", info, e); supplier = new DefaultTimerSupplier(loader); } } if (supplier instanceof PluginInfoInitialized) { ((PluginInfoInitialized)supplier).init(info); } else { SolrPluginUtils.invokeSetters(supplier, info.initArgs, true); } return supplier; }
Example #7
Source File: MetricSuppliers.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Create a {@link Meter} supplier. * @param loader resource loader * @param info plugin configuration, or null for default * @return configured supplier instance, or default instance if configuration was invalid */ @SuppressWarnings({"unchecked"}) public static MetricRegistry.MetricSupplier<Meter> meterSupplier(SolrResourceLoader loader, PluginInfo info) { MetricRegistry.MetricSupplier<Meter> supplier; if (info == null || info.className == null || info.className.isEmpty()) { supplier = new DefaultMeterSupplier(); } else { try { supplier = loader.newInstance(info.className, MetricRegistry.MetricSupplier.class); } catch (Exception e) { log.warn("Error creating custom Meter supplier (will use default): {}",info, e); supplier = new DefaultMeterSupplier(); } } if (supplier instanceof PluginInfoInitialized) { ((PluginInfoInitialized)supplier).init(info); } else { SolrPluginUtils.invokeSetters(supplier, info.initArgs, true); } return supplier; }
Example #8
Source File: MetricSuppliers.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * Create a {@link Counter} supplier. * @param loader resource loader * @param info plugin configuration, or null for default * @return configured supplier instance, or default instance if configuration was invalid */ @SuppressWarnings({"unchecked"}) public static MetricRegistry.MetricSupplier<Counter> counterSupplier(SolrResourceLoader loader, PluginInfo info) { if (info == null || info.className == null || info.className.trim().isEmpty()) { return new DefaultCounterSupplier(); } MetricRegistry.MetricSupplier<Counter> supplier; try { supplier = loader.newInstance(info.className, MetricRegistry.MetricSupplier.class); } catch (Exception e) { log.warn("Error creating custom Counter supplier (will use default): {}", info, e); supplier = new DefaultCounterSupplier(); } if (supplier instanceof PluginInfoInitialized) { ((PluginInfoInitialized)supplier).init(info); } else { SolrPluginUtils.invokeSetters(supplier, info.initArgs, true); } return supplier; }
Example #9
Source File: DisMaxQParser.java From lucene-solr with Apache License 2.0 | 6 votes |
protected Query getUserQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser up, SolrParams solrParams) throws SyntaxError { String minShouldMatch = parseMinShouldMatch(req.getSchema(), solrParams); Query dis = up.parse(userQuery); Query query = dis; if (dis instanceof BooleanQuery) { BooleanQuery.Builder t = new BooleanQuery.Builder(); SolrPluginUtils.flattenBooleanQuery(t, (BooleanQuery) dis); boolean mmAutoRelax = params.getBool(DisMaxParams.MM_AUTORELAX, false); SolrPluginUtils.setMinShouldMatch(t, minShouldMatch, mmAutoRelax); query = QueryUtils.build(t, this); } return query; }
Example #10
Source File: ExtendedDismaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Parses the user's original query. This method attempts to cleanly parse the specified query string using the specified parser, any Exceptions are ignored resulting in null being returned. * * @param up parser used * @param mainUserQuery query string that is parsed * @param clauses used to dictate "min should match" logic * @param config Configuration options for this parse request * @return the resulting query with "min should match" rules applied as specified in the config. * @see #parseEscapedQuery */ protected Query parseOriginalQuery(ExtendedSolrQueryParser up, String mainUserQuery, List<Clause> clauses, ExtendedDismaxConfiguration config) { Query query = null; try { up.setRemoveStopFilter(!config.stopwords); up.exceptions = true; query = up.parse(mainUserQuery); if (shouldRemoveStopFilter(config, query)) { // if the query was all stop words, remove none of them up.setRemoveStopFilter(true); query = up.parse(mainUserQuery); } } catch (Exception e) { // ignore failure and reparse later after escaping reserved chars up.exceptions = false; } if(query == null) { return null; } // For correct lucene queries, turn off mm processing if no explicit mm spec was provided // and there were explicit operators (except for AND). if (query instanceof BooleanQuery) { // config.minShouldMatch holds the value of mm which MIGHT have come from the user, // but could also have been derived from q.op. String mmSpec = config.minShouldMatch; if (foundOperators(clauses, config.lowercaseOperators)) { mmSpec = config.solrParams.get(DisMaxParams.MM, "0%"); // Use provided mm spec if present, otherwise turn off mm processing } query = SolrPluginUtils.setMinShouldMatch((BooleanQuery)query, mmSpec, config.mmAutoRelax); } return query; }
Example #11
Source File: Normalizer.java From lucene-solr with Apache License 2.0 | 5 votes |
public static Normalizer getInstance(SolrResourceLoader solrResourceLoader, String className, Map<String,Object> params) { final Normalizer f = solrResourceLoader.newInstance(className, Normalizer.class); if (params != null) { SolrPluginUtils.invokeSetters(f, params.entrySet()); } f.validate(); return f; }
Example #12
Source File: DisMaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Uses {@link SolrPluginUtils#parseFieldBoosts(String)} with the 'qf' parameter. Falls back to the 'df' parameter */ public static Map<String, Float> parseQueryFields(final IndexSchema indexSchema, final SolrParams solrParams) throws SyntaxError { Map<String, Float> queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(DisMaxParams.QF)); if (queryFields.isEmpty()) { String df = solrParams.get(CommonParams.DF); if (df == null) { throw new SyntaxError("Neither "+DisMaxParams.QF+" nor "+CommonParams.DF +" are present."); } queryFields.put(df, 1.0f); } return queryFields; }
Example #13
Source File: DisMaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
/** Adds the main query to the query argument. If it's blank then false is returned. */ protected boolean addMainQuery(BooleanQuery.Builder query, SolrParams solrParams) throws SyntaxError { Map<String, Float> phraseFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(DisMaxParams.PF)); float tiebreaker = solrParams.getFloat(DisMaxParams.TIE, 0.0f); /* a parser for dealing with user input, which will convert * things to DisjunctionMaxQueries */ SolrPluginUtils.DisjunctionMaxQueryParser up = getParser(queryFields, DisMaxParams.QS, solrParams, tiebreaker); /* for parsing sloppy phrases using DisjunctionMaxQueries */ SolrPluginUtils.DisjunctionMaxQueryParser pp = getParser(phraseFields, DisMaxParams.PS, solrParams, tiebreaker); /* * * Main User Query * * */ parsedUserQuery = null; String userQuery = getString(); altUserQuery = null; if (StringUtils.isBlank(userQuery)) { // If no query is specified, we may have an alternate altUserQuery = getAlternateUserQuery(solrParams); if (altUserQuery == null) return false; query.add(altUserQuery, BooleanClause.Occur.MUST); } else { // There is a valid query string userQuery = SolrPluginUtils.partialEscape(SolrPluginUtils.stripUnbalancedQuotes(userQuery)).toString(); userQuery = SolrPluginUtils.stripIllegalOperators(userQuery).toString(); parsedUserQuery = getUserQuery(userQuery, up, solrParams); query.add(parsedUserQuery, BooleanClause.Occur.MUST); Query phrase = getPhraseQuery(userQuery, pp); if (null != phrase) { query.add(phrase, BooleanClause.Occur.SHOULD); } } return true; }
Example #14
Source File: DisMaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
protected Query getPhraseQuery(String userQuery, SolrPluginUtils.DisjunctionMaxQueryParser pp) throws SyntaxError { /* * * Add on Phrases for the Query * * */ /* build up phrase boosting queries */ /* if the userQuery already has some quotes, strip them out. * we've already done the phrases they asked for in the main * part of the query, this is to boost docs that may not have * matched those phrases but do match looser phrases. */ String userPhraseQuery = userQuery.replace("\"", ""); return pp.parse("\"" + userPhraseQuery + "\""); }
Example #15
Source File: DisMaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
protected SolrPluginUtils.DisjunctionMaxQueryParser getParser(Map<String, Float> fields, String paramName, SolrParams solrParams, float tiebreaker) { int slop = solrParams.getInt(paramName, 0); SolrPluginUtils.DisjunctionMaxQueryParser parser = new SolrPluginUtils.DisjunctionMaxQueryParser(this, IMPOSSIBLE_FIELD_NAME); parser.addAlias(IMPOSSIBLE_FIELD_NAME, tiebreaker, fields); parser.setPhraseSlop(slop); parser.setSplitOnWhitespace(true); return parser; }
Example #16
Source File: TermVectorComponent.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void finishStage(ResponseBuilder rb) { if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) { NamedList<Object> termVectorsNL = new NamedList<>(); @SuppressWarnings({"unchecked", "rawtypes"}) Map.Entry<String, Object>[] arr = new NamedList.NamedListEntry[rb.resultIds.size()]; for (ShardRequest sreq : rb.finished) { if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) == 0 || !sreq.params.getBool(COMPONENT_NAME, false)) { continue; } for (ShardResponse srsp : sreq.responses) { @SuppressWarnings({"unchecked"}) NamedList<Object> nl = (NamedList<Object>)srsp.getSolrResponse().getResponse().get(TERM_VECTORS); // Add metadata (that which isn't a uniqueKey value): Object warningsNL = nl.get(TV_KEY_WARNINGS); // assume if that if warnings is already present; we don't need to merge. if (warningsNL != null && termVectorsNL.indexOf(TV_KEY_WARNINGS, 0) < 0) { termVectorsNL.add(TV_KEY_WARNINGS, warningsNL); } // UniqueKey data SolrPluginUtils.copyNamedListIntoArrayByDocPosInResponse(nl, rb.resultIds, arr); } } // remove nulls in case not all docs were able to be retrieved SolrPluginUtils.removeNulls(arr, termVectorsNL); rb.rsp.add(TERM_VECTORS, termVectorsNL); } }
Example #17
Source File: HighlightComponent.java From lucene-solr with Apache License 2.0 | 5 votes |
protected void addHighlights(Object[] objArr, Object obj, Map<Object, ShardDoc> resultIds) { @SuppressWarnings({"unchecked"}) Map.Entry<String, Object>[] arr = (Map.Entry<String, Object>[])objArr; @SuppressWarnings({"rawtypes"}) NamedList hl = (NamedList)obj; SolrPluginUtils.copyNamedListIntoArrayByDocPosInResponse(hl, resultIds, arr); }
Example #18
Source File: DebugComponent.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) { if (!rb.isDebug()) return; // Turn on debug to get explain only when retrieving fields if ((sreq.purpose & ShardRequest.PURPOSE_GET_FIELDS) != 0) { sreq.purpose |= ShardRequest.PURPOSE_GET_DEBUG; // always distribute the latest version of global stats sreq.purpose |= ShardRequest.PURPOSE_SET_TERM_STATS; StatsCache statsCache = rb.req.getSearcher().getStatsCache(); statsCache.sendGlobalStats(rb, sreq); if (rb.isDebugAll()) { sreq.params.set(CommonParams.DEBUG_QUERY, "true"); } else { if (rb.isDebugQuery()){ sreq.params.add(CommonParams.DEBUG, CommonParams.QUERY); } if (rb.isDebugResults()){ sreq.params.add(CommonParams.DEBUG, CommonParams.RESULTS); } } } else { sreq.params.set(CommonParams.DEBUG_QUERY, "false"); sreq.params.set(CommonParams.DEBUG, "false"); } if (rb.isDebugTimings()) { sreq.params.add(CommonParams.DEBUG, CommonParams.TIMING); } if (rb.isDebugTrack()) { sreq.params.add(CommonParams.DEBUG, CommonParams.TRACK); sreq.params.set(CommonParams.REQUEST_ID, rb.req.getParams().get(CommonParams.REQUEST_ID)); sreq.params.set(CommonParams.REQUEST_PURPOSE, SolrPluginUtils.getRequestPurpose(sreq.purpose)); } }
Example #19
Source File: QueryComponent.java From lucene-solr with Apache License 2.0 | 5 votes |
protected void doPrefetch(ResponseBuilder rb) throws IOException { SolrQueryRequest req = rb.req; SolrQueryResponse rsp = rb.rsp; //pre-fetch returned documents if (!req.getParams().getBool(ShardParams.IS_SHARD,false) && rb.getResults().docList != null && rb.getResults().docList.size()<=50) { SolrPluginUtils.optimizePreFetchDocs(rb, rb.getResults().docList, rb.getQuery(), req, rsp); } }
Example #20
Source File: RecoveryStrategy.java From lucene-solr with Apache License 2.0 | 5 votes |
@SuppressWarnings({"unchecked"}) public RecoveryStrategy create(CoreContainer cc, CoreDescriptor cd, RecoveryStrategy.RecoveryListener recoveryListener) { final RecoveryStrategy recoveryStrategy = newRecoveryStrategy(cc, cd, recoveryListener); SolrPluginUtils.invokeSetters(recoveryStrategy, args); return recoveryStrategy; }
Example #21
Source File: SolrHighlighter.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Return a String array of the fields to be highlighted. * Falls back to the programmatic defaults, or the default search field if the list of fields * is not specified in either the handler configuration or the request. * @param query The current Query * @param request The current SolrQueryRequest * @param defaultFields Programmatic default highlight fields, used if nothing is specified in the handler config or the request. */ public String[] getHighlightFields(Query query, SolrQueryRequest request, String[] defaultFields) { String fields[] = request.getParams().getParams(HighlightParams.FIELDS); // if no fields specified in the request, or the handler, fall back to programmatic default, or default search field. if(emptyArray(fields)) { // use default search field from request if highlight fieldlist not specified. if (emptyArray(defaultFields)) { String defaultSearchField = request.getParams().get(CommonParams.DF); fields = null == defaultSearchField ? new String[]{} : new String[]{defaultSearchField}; } else { fields = defaultFields; } } else { Set<String> expandedFields = new LinkedHashSet<String>(); Collection<String> storedHighlightFieldNames = request.getSearcher().getDocFetcher().getStoredHighlightFieldNames(); for (String field : fields) { expandWildcardsInHighlightFields( expandedFields, storedHighlightFieldNames, SolrPluginUtils.split(field)); } fields = expandedFields.toArray(new String[]{}); } // Trim them now in case they haven't been yet. Not needed for all code-paths above but do it here. for (int i = 0; i < fields.length; i++) { fields[i] = fields[i].trim(); } return fields; }
Example #22
Source File: TestExtendedDismaxParser.java From lucene-solr with Apache License 2.0 | 5 votes |
public MultilanguageDismaxConfiguration(SolrParams localParams, SolrParams params, SolrQueryRequest req) { super(localParams, params, req); String language = params.get("language"); if(language != null) { super.queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams("qf_" + language)); } }
Example #23
Source File: DismaxSearchEngineRequestAdapter.java From querqy with Apache License 2.0 | 5 votes |
public DismaxSearchEngineRequestAdapter(final QParser qParser, final SolrQueryRequest request, final String queryString, final SolrParams solrParams, final QuerqyParser querqyParser, final RewriteChain rewriteChain, final InfoLogging infoLogging, final TermQueryCache termQueryCache) { this.qParser = qParser; this.userQueryString = queryString; this.solrParams = solrParams; this.termQueryCache = termQueryCache; this.infoLoggingContext = solrParams.getBool(INFO_LOGGING, false) && infoLogging != null ? new InfoLoggingContext(infoLogging, this) : null; this.querqyParser = querqyParser; this.request = request; this.rewriteChain = rewriteChain; this.context = new HashMap<>(); final int ps0 = solrParams.getInt(PS, 0); final int ps2 = solrParams.getInt(PS2, ps0); final int ps3 = solrParams.getInt(PS3, ps0); final List<FieldParams> phraseFields = SolrPluginUtils .parseFieldBoostsAndSlop(solrParams.getParams(PF),0,ps0); final List<FieldParams> phraseFields2 = SolrPluginUtils .parseFieldBoostsAndSlop(solrParams.getParams(PF2),2,ps2); final List<FieldParams> phraseFields3 = SolrPluginUtils .parseFieldBoostsAndSlop(solrParams.getParams(PF3),3,ps3); allPhraseFields = new ArrayList<>(phraseFields.size() + phraseFields2.size() + phraseFields3.size()); allPhraseFields.addAll(phraseFields); allPhraseFields.addAll(phraseFields2); allPhraseFields.addAll(phraseFields3); minShouldMatch = DisMaxQParser.parseMinShouldMatch(request.getSchema(), solrParams); }
Example #24
Source File: LTRFeatureLoggerTransformerFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings({"unchecked"}) public void init(@SuppressWarnings("rawtypes") NamedList args) { super.init(args); threadManager = LTRThreadModule.getInstance(args); SolrPluginUtils.invokeSetters(this, args); }
Example #25
Source File: MultipleAdditiveTreesModel.java From lucene-solr with Apache License 2.0 | 5 votes |
private RegressionTreeNode createRegressionTreeNode(Map<String,Object> map) { final RegressionTreeNode rtn = new RegressionTreeNode(); if (map != null) { SolrPluginUtils.invokeSetters(rtn, map.entrySet()); } return rtn; }
Example #26
Source File: MultipleAdditiveTreesModel.java From lucene-solr with Apache License 2.0 | 5 votes |
private RegressionTree createRegressionTree(Map<String,Object> map) { final RegressionTree rt = new RegressionTree(); if (map != null) { SolrPluginUtils.invokeSetters(rt, map.entrySet()); } return rt; }
Example #27
Source File: NeuralNetworkModel.java From lucene-solr with Apache License 2.0 | 5 votes |
@SuppressWarnings({"unchecked"}) protected Layer createLayer(Object o) { final DefaultLayer layer = new DefaultLayer(); if (o != null) { SolrPluginUtils.invokeSetters(layer, ((Map<String,Object>) o).entrySet()); } return layer; }
Example #28
Source File: LTRThreadModule.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings({"unchecked"}) public void init(@SuppressWarnings({"rawtypes"})NamedList args) { if (args != null) { SolrPluginUtils.invokeSetters(this, args); } validate(); if (this.totalPoolThreads > 1 ){ ltrSemaphore = new Semaphore(totalPoolThreads); } else { ltrSemaphore = null; } }
Example #29
Source File: ExtendedDismaxQParser.java From lucene-solr with Apache License 2.0 | 5 votes |
/** * Parses an escaped version of the user's query. This method is called * in the event that the original query encounters exceptions during parsing. * * @param up parser used * @param escapedUserQuery query that is parsed, should already be escaped so that no trivial parse errors are encountered * @param config Configuration options for this parse request * @return the resulting query (flattened if needed) with "min should match" rules applied as specified in the config. * @see #parseOriginalQuery * @see SolrPluginUtils#flattenBooleanQuery */ protected Query parseEscapedQuery(ExtendedSolrQueryParser up, String escapedUserQuery, ExtendedDismaxConfiguration config) throws SyntaxError { Query query = up.parse(escapedUserQuery); if (query instanceof BooleanQuery) { BooleanQuery.Builder t = new BooleanQuery.Builder(); SolrPluginUtils.flattenBooleanQuery(t, (BooleanQuery)query); SolrPluginUtils.setMinShouldMatch(t, config.minShouldMatch, config.mmAutoRelax); query = QueryUtils.build(t, this); } return query; }
Example #30
Source File: LTRQParserPlugin.java From lucene-solr with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings({"unchecked"}) public void init(@SuppressWarnings("rawtypes") NamedList args) { super.init(args); threadManager = LTRThreadModule.getInstance(args); SolrPluginUtils.invokeSetters(this, args); }