소스 검색

分词器修改

CzRger 5 달 전
부모
커밋
1a0452fc3a
1개의 변경된 파일48개의 추가작업 그리고 7개의 파일을 삭제
  1. 48 7
      src/views/manage/index/text-detail.vue

+ 48 - 7
src/views/manage/index/text-detail.vue

@@ -82,7 +82,7 @@
           :min="1"
           :max="999"
         />
-        <div class="text-table" v-if="state.form.fieldType === 'text'">
+        <div class="text-table" v-if="state.form.fieldType === 'keyword'">
           <div class="__cus-title_1">分词器</div>
           <CusTable
             :data="state.textTable.data"
@@ -97,6 +97,42 @@
                 :disabled="state.textTable.data.length < 2"
               />
             </template>
+            <template #minGram-column-value="{scope}">
+              <CusFormColumn
+                v-if="scope.row.key === 'ngram_pinyin_IndexAnalyzer'"
+                class="__cus-table-form-column"
+                :span="24"
+                v-model:param="scope.row.minGram"
+                link="input-number"
+                :precision="0"
+                :min="0"
+                :max="50"
+                :rules="[
+                  {
+                    handle: (val) => Number(val) <= Number(scope.row.maxGram),
+                    message: '最小步长需小于等于最大步长'
+                  }
+                ]"
+              />
+            </template>
+            <template #maxGram-column-value="{scope}">
+              <CusFormColumn
+                v-if="scope.row.key === 'ngram_pinyin_IndexAnalyzer'"
+                class="__cus-table-form-column"
+                :span="24"
+                v-model:param="scope.row.maxGram"
+                link="input-number"
+                :precision="0"
+                :min="0"
+                :max="50"
+                :rules="[
+                  {
+                    handle: (val) => Number(val) >= Number(scope.row.minGram),
+                    message: '最小步长需小于等于最大步长'
+                  }
+                ]"
+              />
+            </template>
             <template #do-header-value="{scope}">
               <CusFormColumn
                 class="__cus-table-form-column"
@@ -144,6 +180,8 @@ const state: any = reactive({
     tableHead: [
       {value: "key", label: "分词器"},
       {value: "value", label: "主要"},
+      {value: "minGram", label: "最小步长"},
+      {value: "maxGram", label: "最大步长"},
       {value: "do", label: "操作", width: 200, fixed: 'right'},
     ],
     data: [],
@@ -163,7 +201,7 @@ const titleCpt = computed(() => {
 })
 const onSubmit = () => {
   ref_form.value.submit().then(() => {
-    if (state.form.fieldType === 'text') {
+    if (state.form.fieldType === 'keyword') {
       if (state.textTable.data.length < 2) {
         ElMessage({
           message: '请至少选择两个分词器!',
@@ -187,7 +225,7 @@ const onSubmit = () => {
       type: "warning",
     } as any).then(() => {
       state.loading = true
-      if (state.form.fieldType === 'text') {
+      if (state.form.fieldType === 'keyword') {
         state.form.fieldAnalyzer = JSON.stringify(state.textTable.data)
       } else {
         state.form.fieldAnalyzer = null
@@ -235,9 +273,12 @@ watch(() => props.show, (n) => {
 })
 const handleChangeFcq = (val) => {
   if (val) {
-    state.textTable.data.push({
-      key: val, value: '0'
-    })
+    const obj = {key: val, value: '0'}
+    if (val === 'ngram_pinyin_IndexAnalyzer') {
+      obj.minGram = 3
+      obj.maxGram = 3
+    }
+    state.textTable.data.push(obj)
     setTimeout(() => {
       state.textTable.fcqSelect = ''
     }, 100)
@@ -245,7 +286,7 @@ const handleChangeFcq = (val) => {
 }
 watch(() => state.form.searchShow, (n) => {
   if (n == 1) {
-    state.form.fieldType = 'text'
+    state.form.fieldType = 'keyword'
   }
 })
 const initDictionary = () => {