Examples of SolrParams


Examples of org.apache.solr.common.params.SolrParams

  private static final Logger log = LoggerFactory.getLogger(XSLTResponseWriter.class);
  private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);
 
  public void init(NamedList n) {
      final SolrParams p = SolrParams.toSolrParams(n);
      xsltCacheLifetimeSeconds = p.getInt(XSLT_CACHE_PARAM,XSLT_CACHE_DEFAULT);
      log.info("xsltCacheLifetimeSeconds=" + xsltCacheLifetimeSeconds);
  }
View Full Code Here

Examples of org.apache.solr.request.SolrParams

  public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
    numRequests++;

    try {
      U.setDefaults(req,defaults,appends,invariants);
      SolrParams p = req.getParams();
      String sreq = p.get(Q);

      String defaultField = p.get(DF);

      // find fieldnames to return (fieldlist)
      String fl = p.get(SolrParams.FL);
      int flags = 0;
      if (fl != null) {
        flags |= U.setReturnFields(fl, rsp);
      }

      if (sreq==null) throw new SolrException(400,"Missing queryString");
      List<String> commands = StrUtils.splitSmart(sreq,';');

      String qs = commands.size() >= 1 ? commands.get(0) : "";
      Query query = QueryParsing.parseQuery(qs, defaultField, p, req.getSchema());

      // If the first non-query, non-filter command is a simple sort on an indexed field, then
      // we can use the Lucene sort ability.
      Sort sort = null;
      if (commands.size() >= 2) {
        QueryParsing.SortSpec sortSpec = QueryParsing.parseSort(commands.get(1), req.getSchema());
        if (sortSpec != null) {
          sort = sortSpec.getSort();
          // ignore the count for now... it's currently only controlled by start & limit on req
          // count = sortSpec.getCount();
        }
      }

      DocListAndSet results = new DocListAndSet();
      NamedList facetInfo = null;
      List<Query> filters = U.parseFilterQueries(req);
      SolrIndexSearcher s = req.getSearcher();

      if (p.getBool(FACET,false)) {
        results = s.getDocListAndSet(query, filters, sort,
                                     p.getInt(START,0), p.getInt(ROWS,10),
                                     flags);
        facetInfo = getFacetInfo(req, rsp, results.docSet);
      } else {
        results.docList = s.getDocList(query, filters, sort,
                                       p.getInt(START,0), p.getInt(ROWS,10),
                                       flags);
      }

      // pre-fetch returned documents
      U.optimizePreFetchDocs(results.docList, query, req, rsp);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.