Dockerized rest API to index pdf files into elasticsearch database. To search using Ollama embeddings with vectorial index or full text search with inverted index.
- Docker and compose Docker installation script
- Clone the repository:
git clone https://github.com/fluques/pdffullsearch.git- Enter directory:
cd pdffullsearch- Set default settings:
cp env.default .env- Run docker-compose file:
docker compose -f .\compose.yaml up --build --force-recreatehttp://127.0.0.1:8989curl -XPUT --data-binary "@filename.pdf" http://127.0.0.1:8989/api/pdffile/upload/filename.pdf/curl -XGET http://127.0.0.1:8989/api/pdffile/knn_search/ \
-H "Content-Type: application/json" \
-d '{"query": "query text", "k": "3", "candidates":"100"}'curl -XGET http://127.0.0.1:8989/api/pdffile/fulltext_search/ \
-H "Content-Type: application/json" \
-d '{"query": "query text"}'import requests
url = 'http://127.0.0.1:8989/api/pdffile/upload/filename.pdf/'
# Open the file in binary read mode ('rb')
with open('filename.pdf', 'rb') as f:
files = {'file': f}
response = requests.put(url, files=files)import requests
url = 'http://127.0.0.1:8989/api/pdffile/knn_search/'
payload ={
'query':'query text',
'k' : '3',
'candidates': '100'
}
response = requests.get(url, json=payload)import requests
url = 'http://127.0.0.1:8989/api/pdffile/fulltext_search/'
payload ={
'query':'query text'
}
response = requests.get(url, json=payload)