Examples of Sort

@author Robert "kebernet" Cooper
  • org.slim3.datastore.Sort
    The collection of constants of class. @author taedium @since 1.0.0
  • org.springframework.data.domain.Sort
    Sort option for queries. You have to provide at least a list of properties to sort for that must not include {@literal null} or empty strings. The direction defaults to {@link Sort#DEFAULT_DIRECTION}. @author Oliver Gierke @author Thomas Darimont
  • org.synyx.hades.domain.Sort
  • prefuse.data.util.Sort
    rg">jeffrey heer
  • wycs.solver.smt.Sort
    A sort is the term for a type in the SMT domain. This class provides a few default sorts as well as the ability to create generic sorts, such as {@link wycs.solver.smt.Sort.Set}s or {@link wycs.solver.smt.Sort.Tuple}s. In order to utilise these generic sorts, it is required that the initialisers (from {@link #generateInitialisers(Solver)} be added to the surrounding {@link wycs.solver.smt.Block} or {@link wycs.solver.smt.Smt2File}.

    This design pattern is required as it is not possible to easily write custom theorems to add to SMT solvers. @author Henry J. Wylde


  • Examples of org.apache.lucene.search.Sort

          // 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));
         
          // Perform the search, using the term query, the serial chain filter, and the
          // distance sort
          TopDocs hits = searcher.search(customScore.createWeight(searcher),dq.getFilter(), 1000); //,sort);
          int results = hits.totalHits;
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

        }

        if (withSearch()) {
          res++;
          Query q = queryMaker.makeQuery();
          Sort sort = getSort();
          TopDocs hits;
          final int numHits = numHits();
          if (numHits > 0) {
            if (sort != null) {
              Weight w = q.weight(searcher);
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

        }
        writer.optimize();
        writer.close();
        Searcher searcher = new IndexSearcher(indexStore, true);

        Sort sort = new Sort();
        Query queryX = new TermQuery(new Term ("contents", "x"));
        Query queryY = new TermQuery(new Term ("contents", "y"));
       
        sort.setSort(new SortField("US", SortField.STRING));
        assertMatches(searcher, queryY, sort, usResult);

        sort.setSort(new SortField("France", SortField.STRING));
        assertMatches(searcher, queryX, sort, "EACGI");

        sort.setSort(new SortField("Sweden", SortField.STRING));
        assertMatches(searcher, queryY, sort, "BJDFH");

        sort.setSort(new SortField("Denmark", SortField.STRING));
        assertMatches(searcher, queryY, sort, "BJDHF");
      }
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

        writer.forceMerge(1);
        writer.close();
        IndexReader reader = DirectoryReader.open(indexStore);
        IndexSearcher searcher = new IndexSearcher(reader);

        Sort sort = new Sort();
        Query queryX = new TermQuery(new Term ("contents", "x"));
        Query queryY = new TermQuery(new Term ("contents", "y"));
       
        sort.setSort(new SortField("US", SortField.Type.STRING));
        assertMatches(searcher, queryY, sort, usResult);

        sort.setSort(new SortField("France", SortField.Type.STRING));
        assertMatches(searcher, queryX, sort, frResult);

        sort.setSort(new SortField("Sweden", SortField.Type.STRING));
        assertMatches(searcher, queryY, sort, svResult);

        sort.setSort(new SortField("Denmark", SortField.Type.STRING));
        assertMatches(searcher, queryY, sort, dkResult);
        reader.close();
        indexStore.close();
      }
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

        w.addDocument(doc);

        IndexSearcher indexSearcher = newSearcher(w.getReader());
        w.close();

        Sort groupSort = Sort.RELEVANCE;
        GroupingSearch groupingSearch = createRandomGroupingSearch(groupField, groupSort, 5, canUseIDV);

        TopGroups<?> groups = groupingSearch.search(indexSearcher, null, new TermQuery(new Term("content", "random")), 0, 10);

        assertEquals(7, groups.totalHitCount);
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

          }

        };

        // === Search for content:random
        AbstractFirstPassGroupingCollector<Comparable<Object>> firstCollector = createRandomFirstPassCollector(dvType, new Sort(), groupField, 10);
        indexSearcher.search(new TermQuery(new Term("content", "random")), firstCollector);
        AbstractDistinctValuesCollector<? extends AbstractDistinctValuesCollector.GroupCount<Comparable<Object>>> distinctValuesCollector
            = createDistinctCountCollector(firstCollector, groupField, countField, dvType);
        indexSearcher.search(new TermQuery(new Term("content", "random")), distinctValuesCollector);

        List<? extends AbstractDistinctValuesCollector.GroupCount<Comparable<Object>>> gcs =  distinctValuesCollector.getGroups();
        Collections.sort(gcs, cmp);
        assertEquals(4, gcs.size());

        compareNull(gcs.get(0).groupValue);
        List<Comparable<?>> countValues = new ArrayList<Comparable<?>>(gcs.get(0).uniqueValues);
        assertEquals(1, countValues.size());
        compare("1", countValues.get(0));

        compare("1", gcs.get(1).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(1).uniqueValues);
        Collections.sort(countValues, nullComparator);
        assertEquals(2, countValues.size());
        compare("1", countValues.get(0));
        compare("2", countValues.get(1));

        compare("2", gcs.get(2).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(2).uniqueValues);
        assertEquals(1, countValues.size());
        compareNull(countValues.get(0));

        compare("3", gcs.get(3).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(3).uniqueValues);
        assertEquals(1, countValues.size());
        compare("1", countValues.get(0));

        // === Search for content:some
        firstCollector = createRandomFirstPassCollector(dvType, new Sort(), groupField, 10);
        indexSearcher.search(new TermQuery(new Term("content", "some")), firstCollector);
        distinctValuesCollector = createDistinctCountCollector(firstCollector, groupField, countField, dvType);
        indexSearcher.search(new TermQuery(new Term("content", "some")), distinctValuesCollector);

        gcs = distinctValuesCollector.getGroups();
        Collections.sort(gcs, cmp);
        assertEquals(3, gcs.size());

        compare("1", gcs.get(0).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(0).uniqueValues);
        assertEquals(2, countValues.size());
        Collections.sort(countValues, nullComparator);
        compare("1", countValues.get(0));
        compare("2", countValues.get(1));

        compare("2", gcs.get(1).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(1).uniqueValues);
        assertEquals(1, countValues.size());
        compareNull(countValues.get(0));

        compare("3", gcs.get(2).groupValue);
        countValues = new ArrayList<Comparable<?>>(gcs.get(2).uniqueValues);
        assertEquals(1, countValues.size());
        compare("1", countValues.get(0));

         // === Search for content:blob
        firstCollector = createRandomFirstPassCollector(dvType, new Sort(), groupField, 10);
        indexSearcher.search(new TermQuery(new Term("content", "blob")), firstCollector);
        distinctValuesCollector = createDistinctCountCollector(firstCollector, groupField, countField, dvType);
        indexSearcher.search(new TermQuery(new Term("content", "blob")), distinctValuesCollector);

        gcs = distinctValuesCollector.getGroups();
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

          for (int searchIter = 0; searchIter < 100; searchIter++) {
            final IndexSearcher searcher = newSearcher(context.indexReader);
            boolean useDv = context.dvType != null && random.nextBoolean();
            DocValuesType dvType = useDv ? context.dvType : null;
            String term = context.contentStrings[random.nextInt(context.contentStrings.length)];
            Sort groupSort = new Sort(new SortField("id", SortField.Type.STRING));
            int topN = 1 + random.nextInt(10);

            List<AbstractDistinctValuesCollector.GroupCount<Comparable<?>>> expectedResult = createExpectedResult(context, term, groupSort, topN);

            AbstractFirstPassGroupingCollector<Comparable<?>> firstCollector = createRandomFirstPassCollector(dvType, groupSort, groupField, topN);
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

       
        IndexSearcher is = newSearcher(ir);
       
        SortField sortField = new SortField("collated", SortField.Type.STRING);
       
        TopDocs td = is.search(new MatchAllDocsQuery(), 5, new Sort(sortField));
        assertEquals("abc", ir.document(td.scoreDocs[0].doc).get("field"));
        assertEquals("ABC", ir.document(td.scoreDocs[1].doc).get("field"));
        ir.close();
        dir.close();
      }
    View Full Code Here

    Examples of org.apache.lucene.search.Sort

            }

            IndexSearcher searcher = new IndexSearcher(reader);
            Hits hits;
            if (sortFields.length > 0) {
                hits = searcher.search(query, new Sort(sortFields));
            } else {
                hits = searcher.search(query);
            }
            return new QueryHits(hits, reader);
        }
    View Full Code Here

    Examples of org.apache.lucene.search.suggest.Sort

          _TestUtil.rmDir(tempDir);
      }

      @Test
      public void testEmpty() throws Exception {
        checkSort(new Sort(), new byte [][] {});
      }
    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.