Skip to content
/ search Public

Dead simple search engine for huge a text file

License

Notifications You must be signed in to change notification settings

soruly/search

Repository files navigation

search

License GitHub Workflow Status Docker Docker Image Size

Dead simple search engine for huge a text file (> 1 million lines), powered by elasticsearch.

Usually used to search for files by names if you have million of files in file system.

Usage

1. Clone this repo

git clone https://github.com/soruly/search.git

2. Configure settings in .env

Copy .env.example to .env, update the PORT if you need to

3. Run docker-compose

docker-compose up -d

4. Prepare your huge text file

For example, generate a filename list

find . > list.txt

5. Index the file

curl -X POST -H "Content-Type: text/plain" --data-binary @list.txt http://127.0.0.1:8001/update

Index update usually takes 15-30 seconds for 1 million records

Note: existing index would be wiped every time on update

6. Open the webpage

Now open the webpage http://127.0.0.1:PORT

Scheduling update

You can schedule a cron job to periodically update the index

0 * * * * find . > list.txt && curl -X POST -H "Content-Type: text/plain" --data-binary @list.txt http://127.0.0.1:PORT/update