@Override public void init( NamedList args ) { this.initArgs = SolrParams.toSolrParams( args ); }
public LocalSolrQueryRequest(SolrCore core, NamedList args) { super(core, SolrParams.toSolrParams(args)); }
@Override public void init(NamedList args) { super.init(args); this.args = SolrParams.toSolrParams(args); }
@Override public void init( final NamedList args ) { if( args != null ) { SolrParams params = SolrParams.toSolrParams( args ); maxNumToLog = params.getInt( "maxNumToLog", maxNumToLog ); } }
public void init(NamedList n) { final SolrParams p = SolrParams.toSolrParams(n); xsltCacheLifetimeSeconds = p.getInt(XSLT_CACHE_PARAM,XSLT_CACHE_DEFAULT); log.info("xsltCacheLifetimeSeconds=" + xsltCacheLifetimeSeconds); }
public void init(NamedList args) { if( args != null ) { Object o = args.get("defaults"); if (o != null && o instanceof NamedList ) { defaults = SolrParams.toSolrParams((NamedList)o); } } }
@Override protected Map<String,ContentStreamLoader> createDefaultLoaders(NamedList args) { SolrParams p = null; if (args != null) { p = SolrParams.toSolrParams(args); } Map<String,ContentStreamLoader> registry = new HashMap<>(); registry.put("application/json", new JsonLoader(fieldMappers).init(p)); registry.put("text/json", registry.get("application/json") ); return registry; }
@Override public void init(NamedList args) { SolrParams params = SolrParams.toSolrParams(args); this.authField = params.get(AUTH_FIELD_PROP, DEFAULT_AUTH_FIELD); log.info("QueryDocAuthorizationComponent authField: " + this.authField); this.allRolesToken = params.get(ALL_ROLES_TOKEN_PROP, ""); log.info("QueryDocAuthorizationComponent allRolesToken: " + this.allRolesToken); this.enabled = params.getBool(ENABLED_PROP, false); log.info("QueryDocAuthorizationComponent enabled: " + this.enabled); }
/** Create filtered SolrParams. */ public SolrParams toFilteredSolrParams(List<String> names) { NamedList<String> nl = new NamedList<>(); for (Iterator<String> it = getParameterNamesIterator(); it.hasNext();) { final String name = it.next(); if (names.contains(name)) { final String[] values = getParams(name); for (String value : values) { nl.add(name, value); } } } return toSolrParams(nl); }
public void init(NamedList initArgs) { SolrParams params = SolrParams.toSolrParams(initArgs); String modelDirectory = params.get("modelDirectory", System.getProperty("model.dir"));//<co id="qqpp.model"/> String wordnetDirectory = params.get("wordnetDirectory", System.getProperty("wordnet.dir"));//<co id="qqpp.wordnet"/> if (modelDirectory != null) { File modelsDir = new File(modelDirectory); try { InputStream chunkerStream = new FileInputStream( new File(modelsDir,"en-chunker.bin")); ChunkerModel chunkerModel = new ChunkerModel(chunkerStream); chunker = new ChunkerME(chunkerModel); //<co id="qqpp.chunker"/> InputStream posStream = new FileInputStream( new File(modelsDir,"en-pos-maxent.bin")); POSModel posModel = new POSModel(posStream); tagger = new POSTaggerME(posModel); //<co id="qqpp.tagger"/> model = new DoccatModel(new FileInputStream( //<co id="qqpp.theModel"/> new File(modelDirectory,"en-answer.bin"))) .getChunkerModel(); probs = new double[model.getNumOutcomes()]; atcg = new AnswerTypeContextGenerator( new File(wordnetDirectory, "dict"));//<co id="qqpp.context"/> } catch (IOException e) { throw new RuntimeException(e); } } } /*
public static SolrQueryRequest substituteField(SolrQueryRequest req){ SolrParams params = req.getParams(); String query = params.get("q"); System.out.println("query before ="+query); query = query.replace(' ', '_'); System.out.println("query after ="+query); NamedList values = params.toNamedList(); values.remove("q"); values.add("q", query); params = SolrParams.toSolrParams(values); req.setParams(params); return req; } }
@Override public void init(final NamedList args) { if (args != null) { SolrParams params = SolrParams.toSolrParams(args); boolean enabled = params.getBool("enabled", true); this.enabled = enabled; overwriteDupes = params.getBool("overwriteDupes", true); signatureField = params.get("signatureField", "signatureField"); signatureTerm = new Term(signatureField, ""); signatureClass = params.get("signatureClass", "org.apache.solr.update.processor.Lookup3Signature"); this.params = params; Object fields = args.get("fields"); sigFields = fields == null ? null: StrUtils.splitSmart((String)fields, ",", true); if (sigFields != null) { Collections.sort(sigFields); } } }
@Override public String init(NamedList config, final SolrCore core) { String result = super.init(config, core); SolrParams initParams = SolrParams.toSolrParams(config); // Initialize Carrot2 controller. Pass initialization attributes, if any. HashMap<String, Object> initAttributes = new HashMap<String, Object>(); extractCarrotAttributes(initParams, initAttributes); this.controller.init(initAttributes); this.idFieldName = core.getSchema().getUniqueKeyField().getName(); // Make sure the requested Carrot2 clustering algorithm class is available String carrotAlgorithmClassName = initParams.get(CarrotParams.ALGORITHM); Class<?> algorithmClass = core.getResourceLoader().findClass(carrotAlgorithmClassName); if (!IClusteringAlgorithm.class.isAssignableFrom(algorithmClass)) { throw new IllegalArgumentException("Class provided as " + CarrotParams.ALGORITHM + " must implement " + IClusteringAlgorithm.class.getName()); } this.clusteringAlgorithmClass = (Class<? extends IClusteringAlgorithm>) algorithmClass; return result; }
@Override public SolrDocumentList search( String queryString ) throws SolrServerException { SolrServer server = solr.solrServer(); NamedList<Object> list = new NamedList<>(); list.add( "q", queryString ); QueryResponse query = server.query( SolrParams.toSolrParams( list ) ); return query.getResults(); } }
public static SolrQueryRequest substituteField(SolrQueryRequest req, String newFieldName){ SolrParams params = req.getParams(); String query = params.get("q"); String currField = StringUtils.substringBetween(" "+query, " ", ":"); if ( currField !=null && newFieldName!=null) query = query.replace(currField, newFieldName); NamedList values = params.toNamedList(); values.remove("q"); values.add("q", query); params = SolrParams.toSolrParams(values); req.setParams(params); return req; }
/** * Create a new QParser for parsing an embedded nested query. * <p> * Remove the nested parameters from the original request to avoid infinite * recursion. */ @Override public QParser subQuery(final String q, final String defaultType) throws ParseException { final QParser nestedParser = super.subQuery(q, defaultType); final NamedList<Object> params = nestedParser.getParams().toNamedList(); params.remove("nested"); nestedParser.setParams(SolrParams.toSolrParams(params)); return nestedParser; }
/** * Create a new QParser for parsing an embedded nested query. * <p> * Remove the nested parameters from the original request to avoid infinite * recursion. */ @Override public QParser subQuery(final String q, final String defaultType) throws SyntaxError { final QParser nestedParser = super.subQuery(q, defaultType); final NamedList<Object> params = nestedParser.getParams().toNamedList(); params.remove("nested"); nestedParser.setParams(SolrParams.toSolrParams(params)); return nestedParser; }
private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException { NamedList params = (NamedList) namedList[0].get("params"); updateRequest.setParams(new ModifiableSolrParams(SolrParams.toSolrParams(params))); if (handler == null) return super.readIterator(fis); Integer commitWithin = null; } else if (o instanceof NamedList) { UpdateRequest req = new UpdateRequest(); req.setParams(new ModifiableSolrParams(SolrParams.toSolrParams((NamedList) o))); handler.update(null, req, null, null); } else if (o instanceof Map.Entry){
@Override public void init(NamedList args) { super.init( args ); NamedList def = null; // redo "defaults" Object o = args.get("defaults"); if (o != null && o instanceof NamedList) { def = (NamedList)o; } else { // no explict defaults list, use all args implicitly // indexOf so "<null name="defaults"/> is valid indicator of no defaults def = args; } // Make the default query type "dismax" if not specified if (def.get(QueryParsing.DEFTYPE) == null) { def = def.clone(); def.add(QueryParsing.DEFTYPE, DisMaxQParserPlugin.NAME); defaults = SolrParams.toSolrParams( def ); } }
GenericSolrRequest suggest = new GenericSolrRequest(METHOD.GET, "/suggest", SolrParams.toSolrParams(params)); SolrResponse response = this._indexio.process(suggest);