Search by keyword

As part of an elearning piece Im making, one section comprises about 50-60 pdf docs of policies etc.
Is there any simple way to search for a doc by entering a part of the name?

I was able to do amazing things with SQLite. Basically, I converted a web app to a Mac / iOS / iPadOS app and then used Swift to send data to the web pages. This allowed for really fast local search. I was able to add search to The Bible, a Dictionary, a thesaurus, and a ZIP Code search for weather related data.

That was fairly complicated coding though. Also, you have another problem… you're using PDFs… ouch!

So…

Challenge #1 — Get the data out of the PDFs and into standard web pages… or create some sort of index of those PDFs.

Challenge #2 — Get some sort of database running.

It sounds like… extreme coding is not an option and perhaps it's not realistic to setup a web server with a database.

So… here's another idea… an inefficient idea… lousy for memory management… but possibly functional for just 50-60 rows…

Step #1 — Create a spreadsheet…

PDF FILE NAME | Keywords

Step #2 — Convert that spreadsheet to a two-dimensional array.

That can be done with Mr. Data Converter… Mr. Data Converter

The basic idea of how a multidimensional array can work in a Hype project is shown here… Free Template Tuesday #11 – Tumult Hype “Multilingual” – Photics.com

Step #3 — Use JavaScript to search that array. With every keystroke event in a field, a list can be returned. JavaScript is used to create that list. That's what I used…

bible-search

I typed the letter “G” in the “Book” field and it returned all the Bible books with the letter “G”. If I keep tying, it filters the list even more…

bible-search-continued

It's a JavaScript event listener, that listens for key presses in the HTML text input element. Each time a key is pressed, the results are updated. It sounds like a lot crunching for the CPU, but it was really quick.

Originally, I was just using big JavaScript arrays, but that was wasting so much memory. It was around a quarter of a gig, which is why I switched to SQLite with Swift.

I've been looking at how to move this over to Progressive Web Apps, for a cross-platform solution, but I don't want to use WASM.

Perhaps IndexedDB is a solution…

…but I haven't really gotten started with my PWA projects. I think IndexedDB might be what I'm looking for, but I don't know enough about it yet. Solving this problem is something I've been wanting to do, but… YouTube. :smile:

2 Likes