List of usage examples for org.apache.solr.common.params CommonParams DF
String DF
To view the source code for org.apache.solr.common.params CommonParams DF.
Click Source Link
From source file:org.tallison.solr.search.concordance.SolrConcordanceBase.java
License:Apache License
public static String getField(SolrParams params, String fallBackField) { //TODO: figure out what the standard way of doing this String fieldName = params.get(CommonParams.FIELD); if (fieldName == null || fieldName.equalsIgnoreCase("null")) { if (fieldName == null || fieldName.equalsIgnoreCase("null")) { fieldName = params.get(CommonParams.DF); }//from ww w . ja v a 2 s . c o m if (fieldName == null || fieldName.equalsIgnoreCase("null")) { //check field list if not in field fieldName = params.get(CommonParams.FL); //TODO: change when/if request allows for multiple terms if (fieldName != null) { fieldName = fieldName.split(",")[0].trim(); } } } return (fieldName != null) ? fieldName : fallBackField; }
From source file:org.tallison.solr.search.SpanQParser.java
License:Apache License
public SpanQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { super(qstr, localParams, params, req); IndexSchema schema = req.getSchema(); //now set the params SolrParams comboParams = SolrParams.wrapDefaults(localParams, params); //preamble to initializing the parser Analyzer analyzer = schema.getQueryAnalyzer(); //default analyzer? defaultFieldName = getParam(CommonParams.DF); if (defaultFieldName != null) { SchemaField sf = schema.getField(defaultFieldName); if (sf != null && sf.getType() != null) { analyzer = sf.getType().getQueryAnalyzer(); }/*ww w . j a v a 2s . c o m*/ } //initialize the parser parser = new SolrSpanQueryParser(defaultFieldName, analyzer, schema, this); parser.setAllowLeadingWildcard(comboParams.getBool(ALLOW_LEADING_WILDCARD, true)); parser.setAutoGeneratePhraseQueries(comboParams.getBool(AUTO_GENERATE_PHRASE, false)); org.apache.lucene.queryparser.classic.QueryParser.Operator defaultOp = DEFAULT_OPERATOR; String defaultOpString = comboParams.get(QueryParsing.OP); if (defaultOpString != null) { if (defaultOpString.equalsIgnoreCase("and")) { defaultOp = org.apache.lucene.queryparser.classic.QueryParser.Operator.AND; } } parser.setDefaultOperator(defaultOp); parser.setFuzzyMaxEdits(comboParams.getInt(MAX_FUZZY_EDITS, 2)); parser.setFuzzyPrefixLength(comboParams.getInt(PREFIX_LENGTH, 0)); parser.setPhraseSlop(comboParams.getInt(PHRASE_SLOP, 0)); parser.setSpanNearMaxDistance(comboParams.getInt(NEAR_MAX, -1)); parser.setSpanNotNearMaxDistance(comboParams.getInt(NOT_NEAR_MAX, -1)); }
From source file:uk.co.flax.biosolr.ontology.search.jena.TextIndexSolr5.java
License:Apache License
private SolrDocumentList solrQuery(String qs, int limit) { SolrQuery sq = new SolrQuery(qs); sq.setIncludeScore(true);// w w w.j a va 2s .c o m if (limit > 0) sq.setRows(limit); else sq.setRows(MAX_N); // The Solr default is 10. try { // Set default field. sq.add(CommonParams.DF, docDef.getPrimaryField()); QueryResponse rsp = solrClient.query(sq); SolrDocumentList docs = rsp.getResults(); return docs; } catch (SolrServerException | IOException e) { exception(e); return null; } }