Parcourir la source

Merge branch 'dev3.2' of ssh://192.168.3.207:10022/qmx/jy-data-extract into dev3.2

wcj il y a 6 ans
Parent
commit
c96c7e5c30
2 fichiers modifiés avec 17 ajouts et 3 suppressions
  1. 4 2
      src/jy/extract/extract.go
  2. 13 1
      src/jy/pretreated/colonkv.go

+ 4 - 2
src/jy/extract/extract.go

@@ -660,7 +660,9 @@ func ExtRegCore(extfrom string, doc map[string]interface{}, j *ju.Job, in *RegLu
 						if tmp["blocktag"] != nil {
 							btag := make(map[string]string)
 							for k := range tmp["blocktag"].(map[string]bool) {
-								btag[k] = TagConfigDesc[k]
+								if TagConfigDesc[k] != ""{
+									btag[k] = TagConfigDesc[k]
+								}
 							}
 							field.BlockTag = btag
 						}
@@ -744,7 +746,7 @@ func getKvByLuaFields(extfrom string, j *ju.Job, in *RegLuaInfo, t map[string][]
 							"value":       text,
 							"type":        tp,
 							"matchtype":   "tag_string",
-							"blocktag":    bl.Tag,
+							"blocktag":    bl.Classify,
 							"weight":      vv.Weight,
 						})
 					}

+ 13 - 1
src/jy/pretreated/colonkv.go

@@ -9,6 +9,7 @@ import (
 	"regexp"
 	"sort"
 	"strings"
+	"unicode/utf8"
 )
 
 type ColonkvEntity struct{}
@@ -680,7 +681,7 @@ func GetKvTags(findkvs []*Kv, title string, tagdbs []string) map[string][]*Tag {
 		kvTags[title] = append(kvTags[title], &Tag{title, title, 0, nil, false})
 	}
 	for _, findkv := range findkvs {
-		k, val := findkv.Key, findkv.Value
+		k, val, nextval := findkv.Key, findkv.Value, strings.TrimSpace(findkv.NextLine)
 		//val是空的话,不打标签
 		if filterValue.MatchString(val) {
 			continue
@@ -715,6 +716,17 @@ func GetKvTags(findkvs []*Kv, title string, tagdbs []string) map[string][]*Tag {
 				}
 				if val != "" {
 					kvTags[tk.Value] = append(kvTags[tk.Value], &Tag{Key: k, Value: val, Weight: tk.Weight})
+				} else if nextval != "" && utf8.RuneCountInString(nextval) < 30 {
+					if strings.Contains(nextval, ":") || strings.Contains(nextval, ":") {
+						if len(strings.Split(nextval, ":")) > 1 || len(strings.Split(nextval, ":")) > 1 {
+							nextval = strings.Split(nextval, ":")[0]
+							nextval = strings.Split(nextval, ":")[0]
+							if strings.TrimSpace(nextval) == "" {
+								continue
+							}
+						}
+					}
+					kvTags[tk.Value] = append(kvTags[tk.Value], &Tag{Key: k, Value: nextval, Weight: tk.Weight})
 				}
 			}
 		} else {