小编The*_*ner的帖子

获取中间件laravel中的url

我有我的中间件,在其中我试图到达页面的当前URL.所以我做了类似的事情:

$url = Request::url();

我用过:

use App\Http\Requests; use Illuminate\Http\Request;

但我一直收到以下错误:

Non-static method Illuminate\Http\Request::url() should not be called statically, assuming $this from incompatible context

有任何想法吗?

url middleware laravel

6
推荐指数
2
解决办法
7430
查看次数

Elasticsearch 在 Java 中使用 Scroll api

我尝试在这里使用示例:https : //www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search-scrolling.html

关于如何在 elasticsearch 中使用 java 滚动。这是代码:

QueryBuilder qb = termQuery("multi", "test");

SearchResponse scrollResp = client.prepareSearch("test")
        .addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
        .setScroll(new TimeValue(60000))
        .setQuery(qb)
        .setSize(100).get(); //max of 100 hits will be returned for each scroll
//Scroll until no hits are returned
do {
for (SearchHit hit : scrollResp.getHits().getHits()) {
    //Handle the hit...
}

scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet();
} while(scrollResp.getHits().getHits().length != 0); // Zero hits mark the end of the scroll and the while loop.
Run Code Online (Sandbox Code Playgroud)

虽然由于某些原因我有一个错误,上面写着The method prepareSearch(String) is undefined for …

java elasticsearch

2
推荐指数
1
解决办法
8413
查看次数

标签 统计

elasticsearch ×1

java ×1

laravel ×1

middleware ×1

url ×1