Forum Moderators: open

Message Too Old, No Replies

Local search engine with Javascript?

search engine without web server

         

mercmobily

2:25 am on Nov 15, 2006 (gmt 0)

10+ Year Member



Hello,

We run a magazine site.
We would like to release all of the articles in one CD, which is easy enough to do.
However, we'd like the CD to have search functionalities (that is, do a full text search on the article's contents) without using Flash. Please bear in mind that there is no web server involved!

Does anybody know if it's possible to do so using Javascript?
We would need two modules: the first one would be the "indexer". This one could be written in any language, really.
The second one would be the "search", which would have to read the index files created by the indexer and return the results.

My main worry is that normally Javascript can't access locally stored files... is there a way around that?

Does anybody know if this has been done before? Is there any code available anywhere?

Thanks a lot,

Merc.

Trace

2:42 pm on Nov 15, 2006 (gmt 0)

10+ Year Member



The content on the CD is static so there shouldn't be a problem (it would be a little more difficult if your content were dynamic). It's a little tedious to do however.

Dump your content into a Javascript array and search that. Have the location of the page in one element of the array and the content in another.

Google : javascript search in files

mercmobily

3:46 pm on Nov 15, 2006 (gmt 0)

10+ Year Member



"Dump your content into a Javascript array and search that. Have the location of the page in one element of the array and the content in another."

There is one problem: there are over 250 files, and each one contains an article. I very much doubt you could put everything in RAM.

I would have to create a list of words, and for each word I would have to store which file it's in, and then create a "search" algotirhm that finds out where the word you're looking for is.

Does it sound doable? Can I store this information on a file?

Merc.

penders

11:55 am on Nov 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's certainly possible with a (massive) JS array... there are several sites where I am at the mo that use this method. 500+ pages of static HTML, run locally (or from a CD), not run from a web server. A 3rd party tool (hhhmmm, can't just remember the name) is used to create the index (a .js file) in the beginning - it is also capable of indexing .doc and .pdf files (and more?)

The 'tool' ignores all the tags and indexes just the basic text. The same tool is also capable of building a server-side index too (I think) if you wish.

The resulting .js file is 600KB+ (!) But if run locally (or from a CD) it works great, and caches nicely.

mercmobily

11:59 am on Nov 16, 2006 (gmt 0)

10+ Year Member



Hi,

Thanks for the info!
I don't suppose you'[d be able to find out what the tool is?
Or... anybody else?

Merc.

penders

1:29 pm on Nov 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I *think* it's called "search maker pro" (I've not used it directly myself, so I am assuming that is what they used) - if you Google for that you'll find it.

Note also, that although it was used to index 500+ pages (and possibly more), the pages were not very wordy!