Python-based_search_engine

A search engine implemented in Python

Table of Contents

General Information

Technologies

Set Up

pip install -r requirements.txt
pip install .

Usage

from pysearch import PySearch
import os

# Create an instance, pointing it to where the data should be stored.
# In this example I will put the data int the current working env
engine = PySearch.PySearch(os.path.join(os.getcwd(), "SearchData"))

# Index some data.
engine.index('email_1', {'text': "Peter,\n\nI'm going to need those TPS reports on my desk first thing tomorrow! And clean up your desk!\n\nLumbergh"})
engine.index('email_2', {'text': 'Everyone,\n\nM-m-m-m-my red stapler has gone missing. H-h-has a-an-anyone seen it?\n\nMilton'})
engine.index('email_3', {'text': "Peter,\n\nYeah, I'm going to need you to come in on Saturday. Don't forget those reports.\n\nLumbergh"})
engine.index('email_4', {'text': 'How do you feel about becoming Management?\n\nThe Bobs'})

# Search on it.
engine.search('Peter')
engine.search('tps report')

Testing

To run all the test cases in the folder ‘test’, simply run:

python -m unittest

Going Further

I will try to use this project as a simple search engine for a web development project.