aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fuzzycat/matching.py58
1 files changed, 47 insertions, 11 deletions
diff --git a/fuzzycat/matching.py b/fuzzycat/matching.py
index 1531ac6..c83e48c 100644
--- a/fuzzycat/matching.py
+++ b/fuzzycat/matching.py
@@ -126,7 +126,12 @@ class FuzzyReleaseMatcher:
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
hits_total = es_compat_hits_total(resp)
if hits_total == 0:
return result
@@ -181,7 +186,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -234,7 +244,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -279,7 +294,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ },
+ index=self.index)
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -324,7 +344,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -357,7 +382,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -388,7 +418,12 @@ class FuzzyReleaseMatcher:
},
}
result = []
- resp = self.es.search(query=query, size=self.size, track_total_hits=True, index=self.index)
+ resp = self.es.search(index=self.index,
+ body={
+ "query": query,
+ "size": self.size,
+ "track_total_hits": True
+ })
if es_compat_hits_total(resp) == 0:
return result
if es_compat_hits_total(resp) > self.size:
@@ -430,6 +465,7 @@ def match_release_fuzzy(
size: int = 5,
es: Optional[Union[str, Type[elasticsearch.client.Elasticsearch]]] = None,
api: DefaultApi = None,
+ index: str = "fatcat_release",
) -> List[ReleaseEntity]:
"""
Given a release entity, return a number similar release entities from
@@ -520,7 +556,7 @@ def match_release_fuzzy(
],
},
}
- resp = es.search(query=query, index="fatcat_release", size=size, track_total_hits=True)
+ resp = es.search(index=index, body={"query": query, "size": size, "track_total_hits": True})
if es_compat_hits_total(resp) > 0:
return response_to_entity_list(resp, entity_type=ReleaseEntity, size=size, api=api)
@@ -548,7 +584,7 @@ def match_release_fuzzy(
],
},
}
- resp = es.search(query=query, index="fatcat_release", size=size, track_total_hits=True)
+ resp = es.search(index=index, body={"query": query, "size": size, "track_total_hits": True})
if es_compat_hits_total(resp) > 0:
return response_to_entity_list(resp, entity_type=ReleaseEntity, size=size, api=api)
@@ -563,7 +599,7 @@ def match_release_fuzzy(
}
}
}
- resp = es.search(query=query, index="fatcat_release", size=size, track_total_hits=True)
+ resp = es.search(index=index, body={"query": query, "size": size, "track_total_hits": True})
if es_compat_hits_total(resp) > 0:
return response_to_entity_list(resp, entity_type=ReleaseEntity, size=size, api=api)
@@ -578,7 +614,7 @@ def match_release_fuzzy(
}
}
}
- resp = es.search(query=query, index="fatcat_release", size=size, track_total_hits=True)
+ resp = es.search(index=index, body={"query": query, "size": size, "track_total_hits": True})
if es_compat_hits_total(resp) > 0:
return response_to_entity_list(resp, entity_type=ReleaseEntity, size=size, api=api)