24

I need to create client side search engine for an offline html application in offline storage like CDROM. I already create it with Win32 and the catalog file is near 2GB (MDB file).

My offline web application use CEF (Chromium Embedded Framework) and PhoneGAP so I can disable the browser web security. I thought the IndexedDB may help me but , I couldn't find anyway to copy the storage file to other media.

  1. My catalog file will be near 2GB, so I can't read all record to memory.
  2. I need to make the output media cross-platfrom with PhoneGAP, so I can't use activeX objects for final search. Also I can disable web security restriction by that tools.
  3. I can create the catalog file and media with any windows application. the key note that the output file that query the catalog should be be pure JavaScript.

Is there any HTML5 big storage system available (I can disable web security by PhoneGAP) to create offline HTML application search catalog that can be copied to other removable media?

Melvin Joseph Mani
  • 1,494
  • 15
  • 25
Mohammad Nikravan
  • 1,543
  • 2
  • 19
  • 22
  • 1
    HTML5's big storage system is [Web SQL](http://www.html5rocks.com/en/tutorials/webdatabase/todo/), but this of course saves the data on the client, not centrally, so I'm not sure if this suitable for you. – Mitya Jul 05 '12 at 09:09
  • 1
    Thanks for your comment but WebSQL deprecated by IndexedDB. IndexedDB is good for me but I need to know how can I move or copy specific database in IndexedDB to other removable media. It look they just available in client that create the database and could not be moved to other place :( – Mohammad Nikravan Jul 05 '12 at 14:06

3 Answers3

8

Reyes is doing a fulltext search engine for this exact purpose : https://github.com/reyesr/fullproof

During last september Paris JS, he did a presentation of the concepts behind : http://kornr.net/prez/paris.js22/#/

Hope it answers your need.

bobylito
  • 3,172
  • 22
  • 27
  • Thanks, for your response. But as i did fast overview it is some kind of db engine like indexeddb with some pros and cons, my issue is how to move my current db with pre-filled data to other computer and phone. – Mohammad Nikravan Nov 09 '12 at 17:44
6

I think meanwhile lunr.js must be considered. It has 3-times the stars on Github.

biphobe
  • 4,525
  • 3
  • 35
  • 46
vanthome
  • 4,816
  • 37
  • 44
1

Saving whole database in .json file definitely wouldn't be efficient, but splitting your database to chunks and saving them as .json files loaded on demand may work just fine - it would require testing though.

And - MongoDB stores database in BSON. You can also think about storing your database in this file format and loading it from your application (I would suggest splitting the whole database to smaller parts anyway).

// edit - If you're going to give away the database as file, then I don't think that it's possible to set any kind of permissions. You could try to encrypt/obfuscate the file, but I have no idea how would that affect the performance or database' contents.

And yes, it is possible to have a standalone html+js application that would read the BSON database without any kind of server. Check this link if you want to know more. I've heard of this before, but I have completely no experience when it comes to handling BSON files in pure JS, so I can't help you out with this. All I could do was to let you know that such a thing exists :)

biphobe
  • 4,525
  • 3
  • 35
  • 46
  • Thanks you for introducing about MongoDB, but these mean I should create a client DBEngine with JavaScript myself wiht JSON file format? But it is standalone project itself, do you know that is it possible to have read only access to MongoDB database via client javaScript only without installing anything in machine except client JavaScript files? – Mohammad Nikravan Aug 23 '12 at 12:05
  • @Madnik7G I've edited my answer because of comment's characters' limit. – biphobe Aug 23 '12 at 12:26
  • 1) I don't need any security, I just need fast access to stored record. 2) I don't know should I accept this as answer or not, it look BSON load all file in memory, also I need indexed db because my db file in near 2GB. I wonder is MongoDB create many chunk files with hierarchical index because it should not load all DB by javascript. do you know a sample that use mongoDB with client javascript? – Mohammad Nikravan Aug 23 '12 at 16:50
  • @Madnik7G If my answer didn't help you out, don't accept it :) And no, I'm sorry, but I'm afraid I can't assist you any further - my knowledge about BSON is purely theoretical. I can't give you any samples of JS-application that would read BSON, but there is nice example in the link I provided in my answer. It looks like reading BSON in JS is quite easy. – biphobe Aug 24 '12 at 06:34
  • Evaluation the sample take much time for me in proper time, I will accept as when as found any solution from MongoDB and it BSON implementation as you mentioned. regards – Mohammad Nikravan Aug 24 '12 at 10:05