News for hackers. Stuff that matters.
Re:WorldBrain's Memex: Bookmarking for the power users of th... by gregsadetsky on Monday May 18, 2020 @04:55PM (#23228249)
It sounds like a really good idea (in addition to images being part of this single file PDF "archive" and thus won't go missing), but the PDFs being searchable depend on how the PDF is made, no?

I printed to PDF this HN thread in Chrome (I assume that the PDF printing was done on the system level by OSX -- EDIT yes, from the file: "/Producer (macOS Version 10.15.2 \(Build 19C57\) Quartz PDFContext)"), and none of the page's strings appear as ascii or utf-8 in the document. grep is unable to find any string in that file.

Do you have a specific print to PDF setup? Or a PDF-aware grep..?

EDIT: Seeing the command-line you're using, the search you do is over the files' names, correct? The PDF/(original web page) text content is not indexed, right? Just to make sure I understand correctly.

Re:WorldBrain's Memex: Bookmarking for the power users of th... by fit2rule on Monday May 18, 2020 @05:02PM (#23228336)
I just use the PDF defaults from whatever browser I'm using at the time. Nothing special involved, just the defaults.

I do use 'pdftotext' to do more fine-grained searching if I need to - but for the most part I find that a simple "ls -l | grep <search>" suffices, since this method preserves page title text too ..

I did the same thing for this thread and had no issues with this command, whatsoever:

    $ pdftotext WorldBrain\'s\ Memex:\ Bookmarking\ for\ the\ power\ users\ of\ the\ web\ \|\ Hacker\ News.pdf - | grep -i "Print-to-pdf"
Results:

".. nothing beats print-to-PDF. Its just awesome." "fancier laid out pages), I Print-to-PDF again after enabling Reader"

Re:WorldBrain's Memex: Bookmarking for the power users of th... by gregsadetsky on Monday May 18, 2020 @05:03PM (#23228344)
Got it, makes sense.
Re:WorldBrain's Memex: Bookmarking for the power users of th... by snazz on Monday May 18, 2020 @05:12PM (#23228432)
> EDIT: Seeing the command-line you're using, the search you do is over the files' names, correct? The PDF/(original web page) text content is not indexed, right? Just to make sure I understand correctly.

pdftotext gets the actual text from the PDF. I don't do this, but I'm sure that you could automate the process of generating a text file for each PDF in a directory with pdftotext and then ripgrep the text files when it's time to search the contents. That would be doable with a makefile or a couple of shell scripts.

Re:WorldBrain's Memex: Bookmarking for the power users of th... by fit2rule on Monday May 18, 2020 @05:16PM (#23228467)
Yeah, my computer is fast enough that I can just do "find . -name '*.pdf' -exec pdftotext {} \; | grep -i someSearchTerm" and come back later. Bonus points that it stays in my Terminal for reference later in the day as needed.
Re:WorldBrain's Memex: Bookmarking for the power users of th... by wolfhumble on Monday May 18, 2020 @08:06PM (#23229836)
Is there a reason why you don't use mdfind instead (built-in spotlight search from the terminal)? That way you can search pdf files directly from the terminal without converting to text first, and the directory is already indexed.

E.g:

[$]mdfind -onlyin ~/MyDirectory someSearchTerm

Re:WorldBrain's Memex: Bookmarking for the power users of th... by fit2rule on Tuesday May 19, 2020 @12:50AM (#23231357)
1: Force of habit, since I use grep and silversearcher elsewhere a lot, but 2: I hate the mdfind indexer service putting garbage all over my disks, so I've turned it off and forgotten about it.
Re:WorldBrain's Memex: Bookmarking for the power users of th... by burntsushi on Tuesday May 19, 2020 @07:02AM (#23233509)
ripgrep can actually do this seamlessly with its preprocessors: https://github.com/BurntSushi/ripgrep/blob/b72ad8f8aa897191c...
Re:WorldBrain's Memex: Bookmarking for the power users of th... by snazz on Tuesday May 19, 2020 @09:20AM (#23234548)
That's absolutely awesome! Much better than my theoretical solution.