Package org.apache.lucene.search

Examples of org.apache.lucene.search.Sort


   public MultiColumnQueryHits executeQuery(SessionImpl session, MultiColumnQuery query, QPath[] orderProps,
      boolean[] orderSpecs, long resultFetchHint) throws IOException, RepositoryException
   {
      checkOpen();

      Sort sort = new Sort(createSortFields(orderProps, orderSpecs));

      final IndexReader reader = getIndexReader();
      JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
      searcher.setSimilarity(getSimilarity());
      return new FilterMultiColumnQueryHits(query.execute(searcher, sort, resultFetchHint))
View Full Code Here


      workingThreads.incrementAndGet();

      try
      {
         Sort sort = new Sort(createSortFields(orderProps, orderSpecs));

         final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
         JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
         searcher.setSimilarity(getSimilarity());
         return new FilterMultiColumnQueryHits(searcher.execute(query, sort, resultFetchHint,
View Full Code Here

      workingThreads.incrementAndGet();

      try
      {
         Sort sort = new Sort(createSortFields(orderProps, orderSpecs));

         final IndexReader reader = getIndexReader();
         JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
         searcher.setSimilarity(getSimilarity());
         return new FilterMultiColumnQueryHits(query.execute(searcher, sort, resultFetchHint))
View Full Code Here

                     break;
               }
            }
            sortField[i++] = new SortField(sc.getAttributePath(), sortType, !sc.isAscending());
         }
         cacheQuery = cacheQuery.sort(new Sort(sortField));
      }

      int projSize = 0;
      if (projections != null && !projections.isEmpty()) {
         projSize = projections.size();
View Full Code Here

   public void testLazyOrdered() throws ParseException {
      populateCache();

      // applying sort
      SortField sortField = new SortField("age", SortField.INT);
      Sort sort = new Sort(sortField);
      cacheQuery.sort(sort);

      for (int i = 0; i < 2; i ++) {
         ResultIterator iterator = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.LAZY));
         assert cacheQuery.getResultSize() == 4 : cacheQuery.getResultSize();
View Full Code Here

   public void testEagerOrdered() throws ParseException {
      populateCache();

      // applying sort
      SortField sortField = new SortField("age", SortField.INT);
      Sort sort = new Sort(sortField);
      cacheQuery.sort(sort);

      ResultIterator iterator = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.EAGER));
      assert cacheQuery.getResultSize() == 4 : cacheQuery.getResultSize();
View Full Code Here

   public void testList() throws ParseException {
      populateCache();

      // applying sort
      SortField sortField = new SortField("age", SortField.INT);
      Sort sort = new Sort(sortField);
      cacheQuery.sort(sort);

      List<Object> results = cacheQuery.list();
      assert results.size() == 4 : cacheQuery.getResultSize();
View Full Code Here

      cacheQuery.firstResult(2);
      cacheQuery.maxResults(1);

      // applying sort
      SortField sortField = new SortField("age", SortField.INT);
      Sort sort = new Sort(sortField);
      cacheQuery.sort(sort);

      List<Object> results = cacheQuery.list();
      assert results.size() == 1;
      assert cacheQuery.getResultSize() == 4;
View Full Code Here

   public void testSetSort() throws ParseException {
      loadTestingData();
      person2.setAge(35);
      person3.setAge(12);

      Sort sort = new Sort( new SortField("age", SortField.STRING));

      queryParser = createQueryParser("name");

      Query luceneQuery = queryParser.parse("Goat");
      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery);
View Full Code Here

      workingThreads.incrementAndGet();

      try
      {
         FieldComparatorSource scs = queryImpl.isCaseInsensitiveOrder() ? this.sics : this.scs;
         Sort sort = new Sort(createSortFields(orderProps, orderSpecs, scs));
         final IndexReader reader = getIndexReader(queryImpl.needsSystemTree());
         JcrIndexSearcher searcher = new JcrIndexSearcher(session, reader, getContext().getItemStateManager());
         searcher.setSimilarity(getSimilarity());
         return new FilterMultiColumnQueryHits(searcher.execute(query, sort, resultFetchHint,
            QueryImpl.DEFAULT_SELECTOR_NAME))
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.