Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sweepai/sweep
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlu1248 committed Dec 12, 2023
2 parents c689e09 + cf0ea47 commit 5d2923a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sweepai/core/lexical_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ class Documentation:


def prepare_index_from_docs(docs):
"""Prepare an index from a list of documents.
This function takes a list of documents as input and returns an index.
"""
all_docs = [Documentation(url, content) for url, content in docs]
if len(all_docs) == 0:
return None
Expand All @@ -260,6 +264,11 @@ def prepare_index_from_docs(docs):


def search_docs(query, index: CustomIndex):
"""Search the documents based on a query and an index.
This function takes a query and an index as input and returns a dictionary of document IDs
and their corresponding scores.
"""
"""Title, score, content"""
if index == None:
return {}
Expand All @@ -281,6 +290,11 @@ def search_docs(query, index: CustomIndex):


def search_index(query, index: CustomIndex):
"""Search the index based on a query.
This function takes a query and an index as input and returns a dictionary of document IDs
and their corresponding scores.
"""
"""Title, score, content"""
if index == None:
return {}
Expand Down

0 comments on commit 5d2923a

Please sign in to comment.