Browse Source

Merge remote-tracking branch 'origin/master'

da-xian 4 months ago
parent
commit
a0e8aae042

+ 2 - 0
.idea/compiler.xml

@@ -9,6 +9,7 @@
         <outputRelativeToContentRoot value="true" />
         <module name="cloudphone" />
         <module name="smartsearch" />
+        <module name="shvvue" />
       </profile>
     </annotationProcessing>
     <bytecodeTargetLevel>
@@ -18,6 +19,7 @@
   <component name="JavacSettings">
     <option name="ADDITIONAL_OPTIONS_OVERRIDE">
       <module name="cloudphone" options="-parameters" />
+      <module name="shvvue" options="-parameters" />
       <module name="smartsearch" options="-parameters" />
     </option>
   </component>

+ 1 - 1
src/main/java/com/bowintek/smartsearch/controller/EsQueryController.java

@@ -53,7 +53,7 @@ public class EsQueryController {
                 limiters.add(new ComparisonResult() {{
                     setValue(formState.getOrg_name_a1());
                     setOpreation("等于");
-                    setFields("org_name_a1");
+                    setFields("org_id_a1");
                     setRelation("AND");
                 }});
             }

+ 3 - 3
src/main/java/com/bowintek/smartsearch/services/impl/AnalyzeServiceImpl.java

@@ -2,6 +2,7 @@ package com.bowintek.smartsearch.services.impl;
 
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.bowintek.smartsearch.mapper.cquery.EsQueryKeywordCQuery;
 import com.bowintek.smartsearch.model.EsQueryKeyword;
 import com.bowintek.smartsearch.services.service.AnalyzeService;
@@ -167,7 +168,7 @@ public class AnalyzeServiceImpl implements AnalyzeService {
 
     public List<AnalyzeModel> analyzeSynonym(String text) {
         try {
-            AnalyzeRequest request = AnalyzeRequest.withIndexAnalyzer(indexCache.get(0), "ik_search_analyzer", text);
+            AnalyzeRequest request = AnalyzeRequest.withIndexAnalyzer(indexCache.get(0), "ik_max_word", text);
             return getAnalyzeModels(request);
         } catch (Exception ex) {
             ex.printStackTrace();
@@ -183,7 +184,7 @@ public class AnalyzeServiceImpl implements AnalyzeService {
 
     private List<AnalyzeModel> getAnalyzeModels(AnalyzeRequest request) throws IOException {
         AnalyzeResponse response = highLevelClient.indices().analyze(request, RequestOptions.DEFAULT);
-        System.out.println(response.toString());
+        System.out.println("AnalyzeResponse:"+ JSONObject.toJSONString(response.getTokens()));
         List<AnalyzeModel> modelList = new ArrayList<>();
         response.getTokens().forEach(lexeme -> {
             AnalyzeModel model = AnalyzeModel.GenModel(lexeme.getType(),
@@ -355,7 +356,6 @@ public class AnalyzeServiceImpl implements AnalyzeService {
             ComparisonResult result = analyzeJava(arys[i]);
             if (result != null) {
                 results.add(result);
-                System.out.println(JSON.toJSON(result));
             }
         }
         return results;

+ 19 - 4
src/main/java/com/bowintek/smartsearch/services/impl/EsQueryServiceImpl.java

@@ -33,6 +33,7 @@ import org.elasticsearch.search.sort.SortOrder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -54,8 +55,23 @@ public class EsQueryServiceImpl implements EsQueryService {
     private static List<EsIndexfieldVo> indexFields = null;
     private static long cacheTime = 0;
 
+    @PostConstruct
+    public void init() {
+        List<EsIndexVo> list1 = esIndexService.getAllList();
+        indexCache = list1.stream()
+                .map(m -> m.getIndexCode())
+                .distinct().collect(Collectors.toList());
+
+        List<EsIndexfieldVo> list2 = list1.get(0).getFieldList();
+
+        indexFields = list2.stream().filter(p -> !p.getDataType().equals("NESTED")).collect(Collectors.toList());
+
+        pathCache = list2.stream().filter(p -> p.getDataType().equals("NESTED"))
+                .map(m -> m.getFieldCode())
+                .distinct().collect(Collectors.toList());
+    }
     public void getCacheList() {
-        synchronized (lockObject) {
+        /*synchronized (lockObject) {
             //从本地缓存加载数据
             long timeSpan = (new Date()).getTime() - cacheTime;
             if (timeSpan > 30 * 1000 || indexCache == null || pathCache == null) {
@@ -74,7 +90,7 @@ public class EsQueryServiceImpl implements EsQueryService {
 
                 cacheTime = (new Date()).getTime();
             }
-        }
+        }*/
     }
 
     public List<String> getIndexCache() {
@@ -214,7 +230,7 @@ public class EsQueryServiceImpl implements EsQueryService {
             log.info("dsl:" + searchRequest.source().toString());
             SearchResponse response = highLevelClient.search(searchRequest, RequestOptions.DEFAULT);
 
-            log.info("response:" + response.toString());
+            //log.info("response:" + response.toString());
 
             //[6]转换结果,可以对不同的index做出参数输出
             List<Map<String, Object>> rows = searchResponse2List(response);
@@ -397,7 +413,6 @@ public class EsQueryServiceImpl implements EsQueryService {
                 line += "  " + entry.getKey()
                         + ":" + (entry.getValue() == null ? "null" : entry.getValue().toString());
             }
-            System.out.println(line);
         }
         return list;
     }

+ 10 - 8
src/main/java/com/bowintek/smartsearch/services/impl/QueryLogServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Component
 public class QueryLogServiceImpl implements QueryLogService {
@@ -28,7 +29,7 @@ public class QueryLogServiceImpl implements QueryLogService {
     private static long cacheTime = 0;
 
     @Override
-    public PageInfo<EsQueryLogVo> getQueryGroupList(Integer page, Integer rows, String queryText){
+    public PageInfo<EsQueryLogVo> getQueryGroupList(Integer page, Integer rows, String queryText) {
         PageHelper.startPage(page, rows);
 
         List<EsQueryLogVo> dataList = esQueryLogCQuery.getQueryGroupList(queryText);
@@ -38,23 +39,23 @@ public class QueryLogServiceImpl implements QueryLogService {
     }
 
     @Override
-    public List<EsQueryLogVo> getHotspotList(Integer maxRows){
+    public List<EsQueryLogVo> getHotspotList(Integer maxRows) {
         return getQueryGroupList(1, maxRows, null).getList();
     }
 
     @Override
-    public List<EsQueryLogVo> getQueryList(String queryText){
+    public List<EsQueryLogVo> getQueryList(String queryText) {
         synchronized (lockObject) {
             //用户输入查询时,从本地缓存加载数据
             long timeSpan = (new Date()).getTime() - cacheTime;
             if (timeSpan > 30 * 1000 || queryTextCache == null) {
-                queryTextCache = getQueryGroupList(0,10000, null).getList();
+                queryTextCache = getQueryGroupList(0, 10000, null).getList();
                 cacheTime = (new Date()).getTime();
             }
         }
 
         List<EsQueryLogVo> rtnList = queryTextCache.stream()
-                .filter(log-> log.getQueryText().contains(queryText)).toList();
+                .filter(log -> log.getQueryText().contains(queryText)).toList();
         return rtnList;
     }
 
@@ -67,10 +68,11 @@ public class QueryLogServiceImpl implements QueryLogService {
 
         return esQueryLogMapper.insert(log);
     }
+
     @Override
-    public List<EsRelationLog> getRelationLogList(String well_common_name){
-        EsRelationLogExample example=new EsRelationLogExample();
+    public List<EsRelationLog> getRelationLogList(String well_common_name) {
+        EsRelationLogExample example = new EsRelationLogExample();
         example.or().andWell_common_nameEqualTo(well_common_name);
-        return  esRelationLogMapper.selectByExample(example);
+        return esRelationLogMapper.selectByExample(example).stream().skip(10).collect(Collectors.toList());
     }
 }

+ 4 - 5
vue/src/components/basic/es-result/query-criteria.vue

@@ -28,8 +28,8 @@
             :callbacks="myCallbacks"></v-tour>
     <div data-v-step="2" v-show="formState.showMoreQuery"
          style="height:90px;"
-         :style="showOverlay && curStepVal==2?'margin:auto;width:60%; z-index:1000;display:inline-block;background:white;':
-         'margin:auto;width: 60%;'">
+         :style="showOverlay && curStepVal==2?'margin:auto;width:70%; z-index:1000;display:inline-block;background:white;':
+         'margin:auto;width: 70%;'">
       <a-divider orientation="left"><b style="color:#4E61D0">1.输入检索控制条件</b></a-divider>
       <a-row :gutter="24">
         <a-col :span="6">
@@ -64,7 +64,7 @@
       </a-row>
     </div>
     <div data-v-step="3" v-show="formState.showMoreQuery"
-         :style="showOverlay && curStepVal==3?'margin:auto;width:60%;z-index:1000;display:inline-block;background:white;':'margin:auto;width: 60%;'">
+         :style="showOverlay && curStepVal==3?'margin:auto;width:70%;z-index:1000;display:inline-block;background:white;':'margin:auto;width: 70%;'">
       <a-divider orientation="left"><b style="color:#4E61D0">2.输入检索内容条件</b></a-divider>
       <a-row :gutter="24">
         <a-col :span="24" class="query-row" v-for="(it,index) in limiters">
@@ -405,8 +405,6 @@ export default defineComponent({
   }
 
   .ant-row {
-    height: 36px;
-
     .ant-col {
       padding: 0px 0px !important;
 
@@ -417,6 +415,7 @@ export default defineComponent({
 
 
     .query-row {
+      margin:5px;
       display: flex;
       justify-items: center;
       justify-content: center;

+ 2 - 2
vue/src/views/esdomain/result.vue

@@ -72,7 +72,7 @@
                   <img src="~@/assets/images/info.png" width="18" height="16"/>查看井筒详情</p>
               </div>
               <div class="search-body-item">
-                <component is="cycleView" :indexSetting="it.indexSetting" :data="it" :key="it.key"></component>
+<!--                <component is="cycleView" :indexSetting="it.indexSetting" :data="it" :key="it.key"></component>-->
                 <component is="tableView" :indexSetting="it.indexSetting" :data="it" :key="it.key"></component>
                 <component is="listView" :indexSetting="it.indexSetting"
                            :fieldCode="'fact_dwr_brief_history_assignment'" :data="it.fact_dwr_brief_history_assignment"
@@ -124,7 +124,7 @@
             <b>你可能要找的对象</b>
             <a-list size="small" :data-source="relationLogList">
               <template #renderItem="{ item }">
-                <a-list-item>{{ item.well_common_name }}
+                <a-list-item>{{ item.linked_well }}
                   <template #actions>
                     <a key="list-loadmore-edit">{{ item.well_type }}</a>
                   </template>