Live data from Hacker News

Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

news.ycombinator.com

31–40 of 92 posts

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#31
Like many others have suggested, local indexing is what I use for this, although some more natural interface may be better for structured search and querying.

What I haven't seen suggested though, is the built-in spotlight. Press CMD+Space, type some unique words that might appear in the document, and spotlight will search it. This also works surprisingly well for non-OCRd images of text, anything inside a zip file, an email, etc..

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#32
post #7

Paperless supports OCR + full text indexing: https://docs.paperless-ngx.com/ As far as AI goes, not sure.

You can use Gpt4all with localdocs to analyze the folder where you store the output of paperless-ngx

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#33

You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.

You wouldn't use a chatbot for the same query you'd use normal search tools for (and on a side note your answer would be much more useful with an example of what those tools would be, it's not really actionable). A vague natural language question over data whose structure you haven't fully understood using terms that might be inexact is not as likely to provide good results with normal search tools as with an llm bas…

Another (ugly but works nice): https://www.recoll.org/pics/index.html

opensource, local, yada yada, almost zero configuration (just add folders, run indexer, wait).

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#35

You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.

I found that grep actually outperformed vector search for many queries. The only thing I was missing was when I didn't know how exactly to phrase something (the exact keyword to use).

Do keyword search systems have workarounds for this? My own idea was for each keyword to generate a list of neighbor keywords in semantic space. I figured with such a dataset, I'd get something approximating vector search for free.

I made some attempts at that (found neighbors by their proximity in text), but I ended up with a lot of noise (words that often go together without having the same meaning). So I'd probably have to use actual embeddings instead.

More generally, any suggestions for full-text indexing? Elasticsearch seems like overkill. I built my own keyword search in Python (simple tf-idf) which was surprisingly easy. (Long-term project is to have an offline copy of a useful/interesting subset of the internet. Acquiring the datasets is also an open question. Common Crawl is mostly random blogs and forum arguments...)

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#36
post #19
post #15

RAG cli from llamaindex, allow you to do it 100% locally when used with ollama or llamacpp instead of OpenAI. https://docs.llamaindex.ai/en/stable/getting_started/starter...

llamaindex has an horrible API, very poor docs and is constantly changing. I do not recommend it.

Any alternative?

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#37

You don't. You use a full-text indexer and normal search tools. A chatbot is only going to decrease the integrity of query results.

> decrease the integrity of query results

What does that even mean. When you know the exact keywords then you use full-text.

When you don't know them then other tools can be helpful.

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#38
If you haven’t given some serious thought to getting rid of most of the documents then consider it. There is very little need to keep most routine documents for more than a few years. If you think you need your electric bill for March 2006 at your fingertips, why?

Re: Ask HN: I have many PDFs – what is the best local way to leverage AI for search?

#39
On MacOS, use HoudahSpot. It’s awesome. Not AI, but as others have said, you likely want plain text search, not “AI” or a chatbot, for something like this.

If you’re having trouble thinking of search terms to plug into HoudahSpot (or grep etc.) then I suppose you could ask a chatbot to assist your brainstorming, and then plug those terms into HoudahSpot/grep/etc.

Post reply on HN