### What problem does this PR solve? Fix graphrag + infinity bugs ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)tags/v0.14.1
| @@ -59,8 +59,8 @@ class KGSearch(Dealer): | |||
| q_vec = matchDense.embedding_data | |||
| src = req.get("fields", ["docnm_kwd", "content_ltks", "kb_id", "img_id", "title_tks", "important_kwd", | |||
| "doc_id", f"q_{len(q_vec)}_vec", "position_list", "name_kwd", | |||
| "q_1024_vec", "q_1536_vec", "available_int", "content_with_weight", | |||
| "weight_int", "weight_flt", "rank_int" | |||
| "available_int", "content_with_weight", | |||
| "weight_int", "weight_flt" | |||
| ]) | |||
| fusionExpr = FusionExpr("weighted_sum", 32, {"weights": "0.5, 0.5"}) | |||
| @@ -114,6 +114,7 @@ def set_progress(task_id, from_page=0, to_page=-1, prog=None, msg="Processing... | |||
| if prog is not None: | |||
| d["progress"] = prog | |||
| try: | |||
| logging.info(f"set_progress({task_id}), progress: {prog}, progress_msg: {msg}") | |||
| TaskService.update_progress(task_id, d) | |||
| except Exception: | |||
| logging.exception(f"set_progress({task_id}) got exception") | |||
| @@ -148,9 +148,9 @@ class ESConnection(DocStoreConnection): | |||
| vector_similarity_weight = float(weights.split(",")[1]) | |||
| for m in matchExprs: | |||
| if isinstance(m, MatchTextExpr): | |||
| minimum_should_match = "0%" | |||
| if "minimum_should_match" in m.extra_options: | |||
| minimum_should_match = str(int(m.extra_options["minimum_should_match"] * 100)) + "%" | |||
| minimum_should_match = m.extra_options.get("minimum_should_match", 0.0) | |||
| if isinstance(minimum_should_match, float): | |||
| minimum_should_match = str(int(minimum_should_match * 100)) + "%" | |||
| bqry.must.append(Q("query_string", fields=m.fields, | |||
| type="best_fields", query=m.matching_text, | |||
| minimum_should_match=minimum_should_match, | |||
| @@ -231,15 +231,10 @@ class InfinityConnection(DocStoreConnection): | |||
| if len(filter_cond) != 0: | |||
| filter_fulltext = f"({filter_cond}) AND {filter_fulltext}" | |||
| logging.debug(f"filter_fulltext: {filter_fulltext}") | |||
| minimum_should_match = "0%" | |||
| if "minimum_should_match" in matchExpr.extra_options: | |||
| minimum_should_match = ( | |||
| str(int(matchExpr.extra_options["minimum_should_match"] * 100)) | |||
| + "%" | |||
| ) | |||
| matchExpr.extra_options.update( | |||
| {"minimum_should_match": minimum_should_match} | |||
| ) | |||
| minimum_should_match = matchExpr.extra_options.get("minimum_should_match", 0.0) | |||
| if isinstance(minimum_should_match, float): | |||
| str_minimum_should_match = str(int(minimum_should_match * 100)) + "%" | |||
| matchExpr.extra_options["minimum_should_match"] = str_minimum_should_match | |||
| for k, v in matchExpr.extra_options.items(): | |||
| if not isinstance(v, str): | |||
| matchExpr.extra_options[k] = str(v) | |||