|
@@ -82,7 +82,7 @@ class TrunksService:
|
|
|
query = query.filter_by(**metadata_condition)
|
|
|
if type:
|
|
|
query = query.filter(Trunks.type == type)
|
|
|
- if type:
|
|
|
+ if file_path:
|
|
|
query = query.filter(Trunks.file_path.like('%'+file_path+'%'))
|
|
|
results = query.order_by('distance').limit(limit).all()
|
|
|
result_list = [{
|
|
@@ -161,18 +161,13 @@ class TrunksService:
|
|
|
|
|
|
content = trunk['content']
|
|
|
sentence_util = SentenceUtil()
|
|
|
- contentSentences = sentence_util.split_text(content)
|
|
|
+ cleanedContent = sentence_util.clean_text(content)
|
|
|
|
|
|
result = []
|
|
|
- for targetSentence in targetSentences:
|
|
|
+ for i, targetSentence in enumerate(targetSentences):
|
|
|
cleanedTarget = sentence_util.clean_text(targetSentence)
|
|
|
- matched = False
|
|
|
- for contentSentence in contentSentences:
|
|
|
- if sentence_util.clean_text(contentSentence) == cleanedTarget:
|
|
|
- matched = True
|
|
|
- break
|
|
|
- if matched:
|
|
|
- result.append(index)
|
|
|
+ if cleanedTarget in cleanedContent:
|
|
|
+ result.append(i)
|
|
|
|
|
|
return result
|
|
|
|