es 插件

類 若 實現NativeScriptFactory接口。A factory to create instances of either {@link ExecutableScript} or {@link SearchScript}

只是一個工廠類,仍需要 創建 上面二者之一。實際中 需 創建 類 繼承?SearchScript接口的實現類AbstractSearchScript 的?子類@ AbstractLongSearchScript?@AbstractDoubleSearchScript。

?

我們使用 它是因為public List<NativeScriptFactory> getNativeScripts() 需要返回的是工廠。?

?

?

NativeScriptFactory

/**
* A factory to create instances of either {@link ExecutableScript} or {@link SearchScript}. Note,
* if this factory creates {@link SearchScript}, it must extend {@link AbstractSearchScript}.
*
* @see AbstractExecutableScript
* @see AbstractSearchScript
* @see AbstractLongSearchScript
* @see AbstractDoubleSearchScript
*/
public interface NativeScriptFactory {

?

ExecutableScript (一般不用,忽略)

* An executable script, can't be used concurrently.

?

SearchScript??接口

AbstractSearchScript (核心類,提供了絕大部分功能的實現)

/**
* A base class for any script type that is used during the search process (custom score, aggs, and so on).
* <p>
* If the script returns a specific numeric type, consider overriding the type specific base classes
* such as {@link AbstractDoubleSearchScript} and {@link AbstractLongSearchScript}
* for better performance.
* <p>
* The use is required to implement the {@link #run()} method.
*/
public abstract class AbstractSearchScript extends AbstractExecutableScript implements LeafSearchScript {

?

它 的核心是 屬性:

private LeafSearchLookup lookup;
private Scorer scorer;

所有方法的實現同和這兩個屬性有關。

setLookup()實現lookup的初始化

通過SearchLookup調用lookup.getLeafSearchLookup(context)實現

searchLookUp則通過DefaultSearchContext.lookup()實現初始化

  lookup():  getQueryShardContext().lookup();

DefaultSearchContext則通過createContext實現初始化

也就是通過QueryShardContext.lookup() 實現。

QueryShardContext :?lookup = new SearchLookup(getMapperService(), indexFieldDataService, types);

? 其主要屬性 及初始化:?

public class SearchLookup {

final DocLookup docMap;

final SourceLookup sourceLookup;

final FieldsLookup fieldsLookup;

public SearchLookup(MapperService mapperService, IndexFieldDataService fieldDataService, @Nullable String[] types) {
docMap = new DocLookup(mapperService, fieldDataService, types);
sourceLookup = new SourceLookup();
fieldsLookup = new FieldsLookup(mapperService, types);
}

?

public class FieldsLookup {

private final MapperService mapperService;
@Nullable
private final String[] types;

FieldsLookup(MapperService mapperService, @Nullable String[] types) {
this.mapperService = mapperService;
this.types = types;
}

?

然后追蹤 傳參的來源:

queryShardContext.setTypes(ShardSearchRequest.types());

?

LocalTransport.sendRequest()

  targetTransport.receiveMessage(version, data, action, requestId, this);

    processReceivedMessage(data, action, sourceTransport, version, requestId);

      StreamInput stream = StreamInput.wrap(data);

      handleRequest(stream, requestId, data.length, sourceTransport, version);

        request.readFrom(stream);

          TaskId.readFromStream(in);

            ShardSearchTransportRequest.readFrom()

              shardSearchLocalRequest.innerReadFrom(in);

                  types = in.readStringArray();

總結: 數據有了,直接用

?

?plsSearchScript 繼承自AbstractSearchScript 類。

?覆寫了run(),run方法會執行plsExScript接口的run().

我們只需要提供一個實現plsExScirpt接口的類

?

轉載于:https://www.cnblogs.com/ydxblog/p/8074058.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/251273.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/251273.shtml
英文地址,請注明出處:http://en.pswp.cn/news/251273.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

使用uni-app報錯this.setData is not a function

一、報錯 出現this.setData is not a function報錯的絕大多數情況是&#xff0c;在回調時&#xff0c;this指向作用域為當前異步方法所在的對象&#xff0c;詳見微信小程序異常處理——this.setData is not a function報錯處理 二、排查原因 但我并沒有在回調中使用this.set…

搭建SpringBoot服務器,在公司內網中使用

搭建SpringBoot服務器&#xff0c;在公司內網中使用。 學習了&#xff1a;https://blog.csdn.net/z3881006/article/details/78902231 就是一個程序&#xff0c;托管于github&#xff1b;https://github.com/spring-io/initializr 轉載于:https://www.cnblogs.com/stono/p/9301…

javascrpt --- 使用jquery添加dom元素和Angular ng-repeat生成select性能比較

今天用兩種方法實現了動態的給select添加option的功能. 第一種是用jquery. // html <select id"drag-pointList"></select> // js $(#drag-pointList).children(option).remove(); // 清空之前的option let list res.data.list ; // res是ajax請…

任何時候,寫下一個類,一定要有三個函數

1、默認構造函數 2、拷貝構造函數 3、虛 析構函數轉載于:https://www.cnblogs.com/buddho/p/8076165.html

【C語言及程序設計】項目2-15:模塊化的簡單銀行系統設計

問題描述&#xff1a; https://edu.csdn.net/course/play/456/4808 // 銀行系統.cpp: 定義控制臺應用程序的入口點。 //#include "stdafx.h" #include <stdlib.h> #pragma warning (disable: 4996)int PassTest(); void ibalance(); void withdraw(); void de…

jquery --- 使用when方法等待2個異步事件結束后執行某一個函數.

$.when(promise1, promise2) .done(function(args1, args2){console.log(args1 args2); }// 上述代碼,等待promise1和promise2執行完,打印出(promise1和promise2)使用的參數 // 注:1.promise1和promise2是異步調用的函數,如ajax請求 // 2.如果執行promise1時用到了一個參數…

Android基礎知識(一)

此篇文章開始逐步記錄一些Android開發的一些相關知識。本文主要講了一些adb的常用指令&#xff0c;Toast的常規使用&#xff0c;Intent的顯式啟動活動&#xff0c;按鈕點擊事件的四種處理方法&#xff0c;一些常見布局。 1. ADB常用指令 Android Debug Bridge adb android調試橋…

Android 6.0 動態權限申請

1. 概述 Android 6.0 (API 23) 之前應用的權限在安裝時全部授予&#xff0c;運行時應用不再需要詢問用戶。在 Android 6.0 或更高版本對權限進行了分類&#xff0c;對某些涉及到用戶隱私的權限可在運行時根據用戶的需要動態授予。這樣就不需要在安裝時被強迫同意某些權限。 2. …

el-input輸入金額,保留兩位小數

需求&#xff1a;“只允許輸入金額保留兩位小數”&#xff0c;有2種實現方法 方法一&#xff08;通過正則控制&#xff09;&#xff1a; html&#xff1a; <el-inputv-model"inputTable.amount"input"formatNum(form.amount, amount)" ></el-i…

jquery --- pip方法

我們先來看下面一個例子: var getPromise $.get(/query); getPromise.done(function(data) {var postPromise $.post(/search, data); }); // ...無法在此處給postPromise方法附加處理器// 上面先使用get方法讀取url為query的數據,在完成后,再使用post方法將數據發送給另一個…

斜率DP總結

chunlvxiong的博客 T1&#xff1a;防御準備 三個月后第一次寫博客&#xff0c;我們從這個題開始&#xff1a;http://www.lydsy.com/JudgeOnline/problem.php?id3156。 這道題DP方程比較好寫&#xff1a;用dp[i]表示1到i全部被控制的最小代價&#xff0c;那么dp[i]min{dp[j](i-…

前端使用react-intl-universal進行國際化

一、國際化 / i18n 目前國際化&#xff0c;就是開發者寫對象&#xff0c;一個key關聯若干語種的翻譯。相比于瀏覽器自帶的翻譯功能&#xff0c;語義更加準確。 “國際化”的簡稱&#xff1a;i18n&#xff08;其來源是英文單詞 internationalization的首末字符i和n&#xff0c;…

守護線程Daemon的理解

1、守護線程伴隨著主線程的銷毀而銷毀&#xff1b; 2、jvm虛擬機中有很多守護線程&#xff0c;隨著main函數的結束而結束&#xff0c;自動回收棧中的內容。 Thread t1 new Thread(){Overridepublic void run() {for (int i 0; i < 10; i) {try {Thread.sleep(1000);} catc…

javascript --- 異步函數的順序進行

假設我們希望某一組異步函數能一次進行,在不使用的任何工具的情況下,可能會編寫出類似下面的代碼: funcs[0](function() {funcs[1](function() {funcs[2](onComplete);}) });// 注:以上代碼運行會出現的一些不方便: // 1.回調太深,不利于閱讀..(100層嵌套...); // 2.不能使用循…

2021前端面試題

基礎知識與素養 JS基本功訓練與思考 程序設計的滲透與應用 業務技巧的積累與訓練 生產力轉換 項目的組織架構 轉換專業人才的全面生產力 什么樣的技術水平決定了你應該學習什么樣的知識與技術&#xff0c;什么樣的知識與技術水平決定了你到什么樣的公司&#xff0c;到什么樣的公…

JS的自定義事件(觀察者模式)

1      var Event {2 on: function (eventName, callback) {3 console.log("eventName:"eventName)4 if (!this.handles) {5 Object.defineProperty(this, "handles", {6 …

glog日志庫使用筆記

日志能方便地診斷程序原因、統計程序運行數據&#xff0c;是大型軟件系統必不可少的組件之一。glog 是google的開源日志系統&#xff0c;相比較log4系列的日志系統&#xff0c;它更加輕巧靈活。 在Github上下載glog&#xff0c;解壓后用CMake生成VS2017工程&#xff08;默認生成…

javascript --- 異步工作流的動態排隊技術

很多情況下,使用async.series和async.paralle存在一個明顯的問題,即: 1.其任務隊列是靜態的,在其調用前,一定要明確任務隊列的數量,一旦明確了任務隊列的數量,就不能改變. 2.倘如要同時并發讀取上千個文件,使用async.paralle明顯不可能(各線程搶資源,根本不夠用),使用async.ser…

java中的內部類總結

內部類不是很好理解&#xff0c;但說白了其實也就是一個類中還包含著另外一個類 如同一個人是由大腦、肢體、器官等身體結果組成&#xff0c;而內部類相當于其中的某個器官之一&#xff0c;例如心臟&#xff1a;它也有自己的屬性和行為&#xff08;血液、跳動&#xff09; 顯然…

elementPlus關閉彈窗,頁面原先滾動條消失

一開始以為是彈窗內容超過一屏引起&#xff0c;改為一屏內也不能解決。 打開控制臺&#xff0c;發現彈窗后自動給body標簽加上了類el-popup-parent–hidden&#xff0c;關閉后也沒去除&#xff0c;因此手動刪除該類。 document.getElementsByTagName(body)[0].className ;