Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
4

How to make simple html/JS search engine

KellerWorthen
KellerWorthen

I am wanting to make a search engine that will search just my website to make it more accessible.
Anybody have ideas on how to do this?

2 years ago
You are viewing a single comment. View All
3
Coder100
Coder100

Hello. Here's the thought process:
First, you index all your pages in a js file:

const pages = [{ url: "[url here]", keywords: ["key","words","here"] }];

And then, to get some search results, you can just do:

let search = "[get user input]"; array.filter(page => page.keywords.some(keyword => keyword.includes(search)))

Hopes this helps!

2 years ago
1
KellerWorthen
KellerWorthen

@Coder100
I'm not sure I understand.

2 years ago
1
KellerWorthen
KellerWorthen

@Coder100
Most of it... Did I mention I suck at JavaScript?

2 years ago