Live data from Hacker News

Static Sites with Elasticsearch

gizra.com

11–20 of 20 posts

Re: Static Sites with Elasticsearch

#11
post #8

Earlier quoted context omitted.

It's mentioned in this post but lunr.js is a clever option if you don't have much content. The idea is that your search page has to create a json object with all your content and lunr will build an index out of it client-side. This sounds like terrible architecture but you could stuff about 100 blog posts into an object the size of one big jpeg. For a few dozen articles it's pretty snappy.

A few dozen articles? I've seen examples with Fuse.js and Hugo searching over 10,000 articles and it is fast. No server-side components required.

I think most people (me included) underestimate how ridiculously tiny raw text is compared to other common file types.

Re: Static Sites with Elasticsearch

#12
post #8

Earlier quoted context omitted.

It's mentioned in this post but lunr.js is a clever option if you don't have much content. The idea is that your search page has to create a json object with all your content and lunr will build an index out of it client-side. This sounds like terrible architecture but you could stuff about 100 blog posts into an object the size of one big jpeg. For a few dozen articles it's pretty snappy.

A few dozen articles? I've seen examples with Fuse.js and Hugo searching over 10,000 articles and it is fast. No server-side components required.

Great way to botch user experience since the user has to download the index.

Re: Static Sites with Elasticsearch

#13

Earlier quoted context omitted.

A few dozen articles? I've seen examples with Fuse.js and Hugo searching over 10,000 articles and it is fast. No server-side components required.

Great way to botch user experience since the user has to download the index.

There are ways to optimize this per section, alphabetically, etc. Otherwise Xapian is very easy to setup and would be my goto over Elasticsearch.

Re: Static Sites with Elasticsearch

#14
post #8
post #7

I've been experimenting with SQLite FTS as a way of adding search to an otherwise static site. The big advantage of SQLite FTS is that it's really cheap to run. The index is a single static file on disk, then you add a Python process (I'm using https://github.com/simonw/datasette ) to run queries against it. Much less resource intensive than running Solr or Elasticsearch. It also works surprisingly well - I've run FT…

It's mentioned in this post but lunr.js is a clever option if you don't have much content. The idea is that your search page has to create a json object with all your content and lunr will build an index out of it client-side. This sounds like terrible architecture but you could stuff about 100 blog posts into an object the size of one big jpeg. For a few dozen articles it's pretty snappy.

You can also do the lunr index creation server side, with lib in php or python, generating a quite smaller file and also reducing processing time on the client side.

I've been developing a podcast hosting solution that parses the xml feed, generate static pages and prebuilds a lunr index, and for ~100 posts, it takes around 30 seconds to build server side and less than a second to download and and load on the client.

Re: Static Sites with Elasticsearch

#15
post #8

Earlier quoted context omitted.

It's mentioned in this post but lunr.js is a clever option if you don't have much content. The idea is that your search page has to create a json object with all your content and lunr will build an index out of it client-side. This sounds like terrible architecture but you could stuff about 100 blog posts into an object the size of one big jpeg. For a few dozen articles it's pretty snappy.

You can also do the lunr index creation server side, with lib in php or python, generating a quite smaller file and also reducing processing time on the client side. I've been developing a podcast hosting solution that parses the xml feed, generate static pages and prebuilds a lunr index, and for ~100 posts, it takes around 30 seconds to build server side and less than a second to download and and load on the client.

What's the file size of the index? Is it just encoded in JSON?

Re: Static Sites with Elasticsearch

#16
post #15

Earlier quoted context omitted.

You can also do the lunr index creation server side, with lib in php or python, generating a quite smaller file and also reducing processing time on the client side. I've been developing a podcast hosting solution that parses the xml feed, generate static pages and prebuilds a lunr index, and for ~100 posts, it takes around 30 seconds to build server side and less than a second to download and and load on the client.

What's the file size of the index? Is it just encoded in JSON?

Yes, it's encoded json for lunr.js. Here's the index for my static-site blog: https://blog.kevinastone.com/search_index.json. It's 305kb un-compressed at the moment (38kb gzipped).

Re: Static Sites with Elasticsearch

#17
If you're looking to do the same on something that's easier to run and manage than ES, consider using Typesense: https://github.com/typesense/typesense

The primary benefits are simplicity, typo tolerance and ability to expose the search engine directly to the front end without having to put it behind an ELB as described in this post for Elasticsearch.

P.S: I work on this.

Re: Static Sites with Elasticsearch

#18
post #17

If you're looking to do the same on something that's easier to run and manage than ES, consider using Typesense: https://github.com/typesense/typesense The primary benefits are simplicity, typo tolerance and ability to expose the search engine directly to the front end without having to put it behind an ELB as described in this post for Elasticsearch. P.S: I work on this.

TypeSense looks nice for this but it could really use an officially supported browser integration so folks can onboard easier I feel https://github.com/typesense/typesense/issues/85

Re: Static Sites with Elasticsearch

#19
post #18
post #17

If you're looking to do the same on something that's easier to run and manage than ES, consider using Typesense: https://github.com/typesense/typesense The primary benefits are simplicity, typo tolerance and ability to expose the search engine directly to the front end without having to put it behind an ELB as described in this post for Elasticsearch. P.S: I work on this.

TypeSense looks nice for this but it could really use an officially supported browser integration so folks can onboard easier I feel https://github.com/typesense/typesense/issues/85

Agree 100%, very close to launching that (within 2 weeks!).

Re: Static Sites with Elasticsearch

#20
post #19
post #18

Earlier quoted context omitted.

TypeSense looks nice for this but it could really use an officially supported browser integration so folks can onboard easier I feel https://github.com/typesense/typesense/issues/85

Agree 100%, very close to launching that (within 2 weeks!).

Looking forward! <3
Post reply on HN