Jump to content
Froman

Live Search - Over 40,000 Records

Recommended Posts

I've built a static site with over 40,000 pages using Jekyll.  I am trying to implement a live search into it without a database.  I tried the w3schools live search example with a xml file I created from my site.  It is very slow.  

Does anyone know of a faster way to parse xml files or am I wasting time.  I enabled gzip compression on the entire site also,  

What  would be the fastest way to search a lot of records and return a result?

Thanks in advance.

Share this post


Link to post
Share on other sites

There is no fast way to search an XML document, because the entire file needs to be loaded into memory and parsed before the search can even begin. You would need to create a file format that is optimized for searching, which is exactly what databases do.

The search has to be done on the server-side as well, since transferring 40,000 records to the client before beginning the search is already a slow task.

Share this post


Link to post
Share on other sites

Under the assumption that the XML files are uniformly constructed.  Why not construct a table in a database that could accommodate all of the XML items in your files, and then write a PHP routine that would extract the values of each item in each file and insert them into the data table?

I know. I was also very hesitant to start using a database, but I am very glad that I did.  For, it is everything at your fingertips -- anything, anywhere,  anytime, in any order, and as much or as little as you want.

Roddy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×