Package org.apache.lucene.search

Examples of org.apache.lucene.search.Sort


     * by terms in the given field with the type of term values explicitly given.
     */
    SortField[] s_fields = new SortField[2];
    s_fields[0] = SortField.FIELD_SCORE;
    s_fields[1] = new SortField(searching.getKeywordField(), SortField.INT, true);
    Sort sort = new Sort(s_fields);
       
        Hits hits = searcher.search(comboQuery, multiFilter, sort);
    int numResults = hits.length();
    //System.out.println(numResults + " found............................");
    int result_count = Math.min(numResults, MAX_RESULT_COUNT);
View Full Code Here


        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
      }
   
    Query query = rb.getQuery();
      SortSpec sortspec = rb.getSortSpec();
      Sort sort = null;
      if (sortspec!=null){
        sort = sortspec.getSort();
      }

      SolrParams solrParams = rb.req.getParams();
View Full Code Here

    String qstring = params.get(CommonParams.Q);
    String df = params.get(CommonParams.DF);
    String sortString = params.get(CommonParams.SORT);
    BoboDefaultQueryBuilder qbuilder = new BoboDefaultQueryBuilder();
    Query query = qbuilder.parseQuery(qstring, df);
    Sort sort = qbuilder.parseSort(sortString);
    BrowseRequest br = null;
    try {
      br=BoboRequestBuilder.buildRequest(params,query,sort);
      logger.info("REQ: "+BrowseProtobufConverter.toProtoBufString(br));
      BrowseResult result=_svc.browse(br);
View Full Code Here

          }
          else {
            lst[i] = new SortField(part,SortField.STRING,top);
          }
        }
        return new Sort(lst);
    }
View Full Code Here

    String qstring = params.get(CommonParams.Q);
    String df = params.get(CommonParams.DF);
    String sortString = params.get(CommonParams.SORT);
    BoboDefaultQueryBuilder qbuilder = new BoboDefaultQueryBuilder();
    Query query = qbuilder.parseQuery(qstring, df);
    Sort sort = qbuilder.parseSort(sortString);
    BrowseRequest br = null;
    try {
      br=BoboRequestBuilder.buildRequest(params,query,sort);
      logger.info("REQ: "+BrowseProtobufConverter.toProtoBufString(br));
      BrowseResult result=_svc.browse(br);
View Full Code Here

          }
          else {
            lst[i] = new SortField(part,SortField.STRING,top);
          }
        }
        return new Sort(lst);
    }
View Full Code Here

      if (mQuery != null) {
        //System.out.println("Query: '" + mQueryText + "' -> '" + mQuery.toString() + "'");

        try {
          SortingOption sortingOption = new SortingOption(request.getParameter("order"));
          Sort sort = new Sort(sortingOption.getSortField());
          //System.out.println(sortingOption.toString());

          topDocsCollector = TopFieldCollector.create(sort, 10000, true, true, true, false);

          mIndexSearcher.search(mQuery, topDocsCollector);
View Full Code Here

    }
  }

  private int runQuery(IndexSearcher s, Query q) throws Exception {
    s.search(q, 10);
    return s.search(q, null, 10, new Sort(new SortField("title", SortField.STRING))).totalHits;
  }
View Full Code Here

    // Create a distance sort
    // As the radius filter has performed the distance calculations
    // already, pass in the filter to reuse the results.
    //
    DistanceFieldComparatorSource dsort = new DistanceFieldComparatorSource(dq.distanceFilter);
    Sort sort = new Sort(new SortField("foo", dsort,false));

    // Perform the search, using the term query, the serial chain filter, and the
    // distance sort
    TopDocs hits = searcher.search(customScore.createWeight(searcher),null, 1000, sort);
    int results = hits.totalHits;
View Full Code Here

    // Create a distance sort
    // As the radius filter has performed the distance calculations
    // already, pass in the filter to reuse the results.
    //
    DistanceFieldComparatorSource dsort = new DistanceFieldComparatorSource(dq.distanceFilter);
    Sort sort = new Sort(new SortField("foo", dsort,false));

    // Perform the search, using the term query, the serial chain filter, and the
    // distance sort
    TopDocs hits = searcher.search(customScore.createWeight(searcher),null, 1000, sort);
    int results = hits.totalHits;
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.Sort

Copyright © 2018 www.massapicom. 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.