Skip to content

Commit 803b86a

Browse files
committed
fix: removed unused function
1 parent 2938912 commit 803b86a

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

gptme_rag/indexing/indexer.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -463,60 +463,6 @@ def compute_relevance_score(
463463

464464
return total_score, scores
465465

466-
def _group_and_score_results(
467-
self,
468-
results: dict,
469-
query: str,
470-
paths: list[Path] | None,
471-
n_results: int,
472-
explain: bool,
473-
) -> tuple[list[Document], list[float], list[dict]]:
474-
"""Group and score search results by source document."""
475-
documents: list[Document] = []
476-
distances: list[float] = []
477-
explanations: list[dict] = []
478-
seen_sources: set[str] = set()
479-
480-
# Extract distances from results
481-
result_distances = results["distances"][0] if "distances" in results else []
482-
483-
# Process results in order, taking only first chunk from each source
484-
for i, doc_id in enumerate(results["ids"][0]):
485-
doc = Document(
486-
content=results["documents"][0][i],
487-
metadata=results["metadatas"][0][i],
488-
doc_id=doc_id,
489-
)
490-
491-
# Skip if doesn't match path filter
492-
if paths and not self._matches_paths(doc, paths):
493-
continue
494-
495-
# Get source ID and skip if we've seen it
496-
source_id = doc_id.split("#chunk")[0]
497-
if source_id in seen_sources:
498-
continue
499-
seen_sources.add(source_id)
500-
501-
# Add document to results
502-
documents.append(doc)
503-
distances.append(result_distances[i])
504-
if explain:
505-
score, score_breakdown = self.compute_relevance_score(
506-
doc, result_distances[i], query, debug=explain
507-
)
508-
explanations.append(
509-
self.explain_scoring(
510-
query, doc, result_distances[i], score_breakdown
511-
)
512-
)
513-
514-
# Stop if we have enough results
515-
if len(documents) >= n_results:
516-
break
517-
518-
return documents, distances, explanations
519-
520466
def _matches_paths(self, doc: Document, paths: list[Path]) -> bool:
521467
"""Check if document matches any of the given paths."""
522468
source = doc.metadata.get("source", "")

0 commit comments

Comments
 (0)