Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 1.71 KB

README.md

File metadata and controls

30 lines (22 loc) · 1.71 KB

Hexlet tests and linter status:

Actions Status Maintainability Test Coverage Flake8 and Testing

Search Engine Project

The Internet is hard to imagine without search engines. To make them work effectively, different search engines are used. In this project, we will write our own implementation of a search engine.

A popular open-source search engine is ElasticSearch.

Usage Example


doc1 = "I can't shoot straight unless I've had a pint!"
doc2 = "Don't shoot shoot shoot that thing at me."
doc3 = "I'm your shooter."

docs = [
    {'id': 'doc1', 'text': doc1},
    {'id': 'doc2', 'text': doc2},
    {'id': 'doc3', 'text': doc3},
]

result = search(docs, 'shoot')
print(result)  # => ['doc2', 'doc1']

This code demonstrates how to use the search function from my search engine module to search for documents containing the word "shoot" in the list of documents represented by Python dictionaries in the docs list. The search function returns a list of document IDs (represented as strings) where the search query was found.