Examples of addSort()


Examples of org.b3log.latke.repository.Query.addSort()

    }

    @Override
    public List<JSONObject> getMostViewCountArticles(final int num) {
        final Query query = new Query();
        query.addSort(Article.ARTICLE_VIEW_COUNT,
                      SortDirection.DESCENDING).
                addSort(Article.ARTICLE_UPDATE_DATE,
                        SortDirection.DESCENDING);
        query.addFilter(Article.ARTICLE_IS_PUBLISHED,
                        FilterOperator.EQUAL, true);
View Full Code Here

Examples of org.elasticsearch.action.search.SearchRequestBuilder.addSort()

        if (range != null) {
            srb.setPostFilter(IndexHelper.getTimestampRangeFilter(range));
        }

        if (sort != null) {
            srb.addSort(sort.getField(), sort.asElastic());
        }

        if (highlight && configuration.isAllowHighlighting()) {
            srb.setHighlighterRequireFieldMatch(false);
            srb.addHighlightedField("*", 0, 0);
View Full Code Here

Examples of org.elasticsearch.action.search.SearchRequestBuilder.addSort()

    private SearchHit oneOfIndex(String index, QueryBuilder q, SortOrder sort) {
        SearchRequestBuilder srb = c.prepareSearch();
        srb.setIndices(index);
        srb.setQuery(q);
        srb.setSize(1);
        srb.addSort("timestamp", sort);

        SearchResponse r = c.search(srb.request()).actionGet();
        if (r.getHits() != null && r.getHits().totalHits() > 0) {
            return r.getHits().getAt(0);
        } else {
View Full Code Here

Examples of org.elasticsearch.client.action.search.SearchRequestBuilder.addSort()

                }
                try {
                    String indexName = nextIndex();
                    SearchRequestBuilder builder = client.client().prepareSearch(indexName);
                    if (ThreadLocalRandom.current().nextBoolean()) {
                        builder.addSort("num", SortOrder.DESC);
                    } else if (ThreadLocalRandom.current().nextBoolean()) {
                        // add a _score based sorting, won't do any sorting, just to test...
                        builder.addSort("_score", SortOrder.DESC);
                    }
                    if (ThreadLocalRandom.current().nextBoolean()) {
View Full Code Here

Examples of org.elasticsearch.client.action.search.SearchRequestBuilder.addSort()

                    SearchRequestBuilder builder = client.client().prepareSearch(indexName);
                    if (ThreadLocalRandom.current().nextBoolean()) {
                        builder.addSort("num", SortOrder.DESC);
                    } else if (ThreadLocalRandom.current().nextBoolean()) {
                        // add a _score based sorting, won't do any sorting, just to test...
                        builder.addSort("_score", SortOrder.DESC);
                    }
                    if (ThreadLocalRandom.current().nextBoolean()) {
                        builder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
                    }
                    int size = Math.abs(ThreadLocalRandom.current().nextInt()) % numberOfHits;
View Full Code Here

Examples of org.springframework.data.solr.core.query.GroupOptions.addSort()

    Query q2 = new SimpleQuery("cat:category1");

    SimpleQuery groupQuery = new SimpleQuery(new SimpleStringCriteria("*:*"));
    GroupOptions groupOptions = new GroupOptions();
    groupQuery.setGroupOptions(groupOptions);
    groupOptions.addSort(new Sort("name", "id"));
    groupOptions.addGroupByField("name");
    groupOptions.addGroupByFunction(f);
    groupOptions.addGroupByQuery(q1);
    groupOptions.addGroupByQuery(q2);
    groupOptions.setLimit(2);
View Full Code Here

Examples of org.springframework.data.solr.core.query.Query.addSort()

  @Test
  public void testWithNullSort() {
    SimpleStringCriteria criteria = new SimpleStringCriteria("field_1:value_1");
    Query query = new SimpleQuery(criteria);
    query.addSort(null); // do this explicitly

    SolrQuery solrQuery = queryParser.constructSolrQuery(query);
    Assert.assertNull(solrQuery.getSortField());
    Assert.assertTrue(solrQuery.getSorts().isEmpty());
  }
View Full Code Here

Examples of org.springframework.data.solr.core.query.SimpleQuery.addSort()

  @Override
  protected Query createQuery(SolrParameterAccessor parameterAccessor) {
    SimpleQuery query = createQueryFromString(this.rawQueryString, parameterAccessor);
    appendProjection(query);
    query.addSort(parameterAccessor.getSort());
    return query;
  }

}
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode.addSort()

            return root;
        }

        OrderByPlanNode orderByNode = new OrderByPlanNode();
        for (ParsedSelectStmt.ParsedColInfo col : m_parsedSelect.m_orderColumns) {
            orderByNode.addSort(col.expression,
                                col.ascending ? SortDirectionType.ASC
                                              : SortDirectionType.DESC);
        }
        orderByNode.addAndLinkChild(root);
        return orderByNode;
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.