yathit / ydn-db-fulltext

Full text search module for YDN-DB
30 stars 4 forks source link

API in the Demo doesn't match API when building #1

Closed jamesmortensen closed 10 years ago

jamesmortensen commented 10 years ago

I'm trying to build this, and it looks really promising from the live demo, but there seems to be some bugs in the examples in the github repo.

I took the minimized file from your demo server and used it in place of the ones I built because I was getting errors when trying to run from what I built.

Uncaught TypeError: Cannot read property 'Storage' of undefined animals.js:26
Animals animals.js:26
(anonymous function)

Basically, ydn.db.crud does not exist. It's undefined. And when I do a diff of the animals.js file on your server with the example animals.js file in github, I see the following differences in the API:

23,24c23
<         keyPath: 'binomial',
<         autoIncrement: true

---
>         keyPath: 'binomial'
27c26
<   this.db = new ydn.db.Storage('animals-3', db_schema);

---
>   this.db = new ydn.db.crud.Storage('animals-3', db_schema);
169c168,171
<   this.db.addEventListener('ready', function(e) {

---
>   this.db.onReady(function(e) {
>     if (e) {
>       throw e;
>     }
180c182
<   }, false, this);

---
>   }, this);

What stands out the most is the difference between ydn.db.Storage and ydn.db.crud.Storage.

What's more, if I try using all of the generated files instead of the minimized files, it seems many of them cannot be found. For instance, animals.html tries to look for deps.js in an ydb-base/src folder instead of ydb-base/js folder. I tried copying the js folder to the src folder, but I'm not even sure if you just did a foldername change or if the deps.js in src is supposed to be different than the one in the js folder. Overall, it just seems like you've made some major changes to file paths and the API, which make it difficult to get through the build process.

I think what you have here is great and would love to dig in more. Would you be able to update your build process to reflect these changes and correct these bugs? I realize this is an open source project and your time may be limited, so any guidance you have would be greatly appreciated.

Thank you! James

P.S. I didn't post on Stack Overflow because Stack Overflow is for technical programming questions. This is more of a support issue, since the problem is actually the build process itself that's broken. Hope this helps.

yathit commented 10 years ago

Hi James,

Thanks for the detail bug report. Yes, bug issue is best suited for this case.

I do feel this project need polishing. For those family with closure library, can figure out these problem quickly.

ydn.db.crud.Storage is internal class, which only supports CRUD operations. All public API exposes as ydn.db.Storage.

deps.js are generated by ant deps - that is why not in the repo. Please see dev section in https://github.com/yathit/ydn-db

You guess is correct that there are major changes in foder convention, but did go through all repos. The convention is that, js files in src folder are to be minified. The minified output are in jsc folder. The file in js folder are used without minification. The config must be out of closure dependency path, and use then by --i compiler flag.

I use this repo source code daily on multiple projects and I am assure it is working fine. But none of the projects use build.xml configuration from this repo. (I just updated and should be fine now).

Build configuration is horrible complex. Some projects need full feature, some need just CRUD, chrome extension project don't want 'websql' parts, some project need IE6 support (remember to include JSON). They all want small js file, so configuration is crazy using partial class. You need to inject multiple files to complete class. You have to understand --i and --p in closure compiler setting.

This repo is critical to many project and I will fix bugs. For compilation, yes, you have to to figure out. It may take 7 days just to get it compiles. But once it compiles, it works well.

yathit commented 10 years ago

I confirm that the example /examples/animals/animals.html works if you have deps files.

jamesmortensen commented 10 years ago

Hi yathit,

Thanks for your detailed reply. I can see this is going to take some time to wrap my head around all of this, as I'm not familiar with closure.

I seem to be missing some dependencies:

Uncaught Error: Undefined nameToPath for ydn.base.exports base.js:619
Uncaught Error: Undefined nameToPath for ydn.async.Deferred base.js:619
Uncaught Error: Undefined nameToPath for ydn.structs.Buffer base.js:619
Uncaught Error: Undefined nameToPath for ydn.debug.error.ArgumentException base.js:619
Uncaught Error: Undefined nameToPath for ydn.debug.error.InternalError base.js:619
Uncaught Error: Undefined nameToPath for ydn.debug.error.InternalError 

Upon further investigation, I noticed in your documentation in the YDN-DB repo README, you're actually referencing resources hosted at Bitbucket, not the actual repos on Github:

Downloads the following three repos a directory.

svn checkout http://closure-library.googlecode.com/svn/trunk/
git clone git@bitbucket.org:ytkyaw/ydn-db.git
git clone https://bitbucket.org/ytkyaw/ydn-base.git

And as I'm writing this, I can see you made commits 2 days ago to the YDN-DB on Bitbucket whereas the Github version last update was in October. I have the copies from Github as specified in the ydn-db-fulltext repo instructions... https://github.com/yathit/ydn-db/commits/master vs https://bitbucket.org/ytkyaw/ydn-db/commits/all. Is there a way to mark a Github repo as "dead"?

I'm going to check out fresh from your Bitbucket repos and try again fresh and let you know how it goes!

Update

It works! Here's a suggested change for the documentation for the ydn-db-fulltext README.md in Github:

Closure library: http://closure-library.googlecode.com/svn/trunk/ YDN-BASE: https://bitbucket.org/ytkyaw/ydn-base.git YDN-DB: git@bitbucket.org:ytkyaw/ydn-db.git fullproof: https://github.com/yathit/fullproof.git natural: https://github.com/yathit/natural.git

NOTE: YDN-BASE and YDN-DB are now hosted on Bitbucket. The Github versions are outdated.

Thanks again, and hope this helps! James

jamesmortensen commented 10 years ago

Another update:

Under the Testing section of ydn-db README on Bitbucket, ant gen-alltest-js should be changed to ant gen-all-test-js to match what's in the build.xml file.

Also, I get the following output when trying to run the unit tests:

Jamess-MacBook-Pro:ydn-db jem$ java -jar ../JsTestDriver-1.3.5.jar --tests all
setting runnermode QUIET
Configuration Error: 
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-base/js/ydn/async.js
] derived from ../ydn-base/js/ydn/async.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-base/js/ydn/json.js
] derived from ../ydn-base/js/ydn/json.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-base/js/ydn/object.js
] derived from ../ydn-base/js/ydn/object.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/rich_storage.js
] derived from ../ydn-db/js/ydn/db/rich_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/key.js
] derived from ../ydn-db/js/ydn/db/base/key.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/i_database.js
] derived from ../ydn-db/js/ydn/db/conn/i_database.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/simple_storage.js
] derived from ../ydn-db/js/ydn/db/conn/simple_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/html5_storage.js
] derived from ../ydn-db/js/ydn/db/conn/html5_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/base.js
] derived from ../ydn-db/js/ydn/db/base/base.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/schema.js
] derived from ../ydn-db/js/ydn/db/base/schema.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/indexed_db.js
] derived from ../ydn-db/js/ydn/db/conn/indexed_db.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/error.js
] derived from ../ydn-db/js/ydn/db/base/error.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/websql.js
] derived from ../ydn-db/js/ydn/db/conn/websql.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-base/js/ydn/error.js
] derived from ../ydn-base/js/ydn/error.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/i_storage.js
] derived from ../ydn-db/js/ydn/db/conn/i_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/conn/storage.js
] derived from ../ydn-db/js/ydn/db/conn/storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/tr/mutex.js
] derived from ../ydn-db/js/ydn/db/tr/mutex.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/tr/i_storage.js
] derived from ../ydn-db/js/ydn/db/tr/i_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/tr/tx_storage.js
] derived from ../ydn-db/js/ydn/db/tr/tx_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/tr/storage.js
] derived from ../ydn-db/js/ydn/db/tr/storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/key_range.js
] derived from ../ydn-db/js/ydn/db/base/key_range.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/base/query.js
] derived from ../ydn-db/js/ydn/db/base/query.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/io/crud_service.js
] derived from ../ydn-db/js/ydn/db/io/crud_service.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/req/request_executor.js
] derived from ../ydn-db/js/ydn/db/req/request_executor.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/req/indexed_db.js
] derived from ../ydn-db/js/ydn/db/req/indexed_db.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/req/simple_store.js
] derived from ../ydn-db/js/ydn/db/req/simple_store.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/req/websql.js
] derived from ../ydn-db/js/ydn/db/req/websql.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/core/tx_storage.js
] derived from ../ydn-db/js/ydn/db/core/tx_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/core/i_storage.js
] derived from ../ydn-db/js/ydn/db/core/i_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/io/query_service.js
] derived from ../ydn-db/js/ydn/db/io/query_service.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/io/query.js
] derived from ../ydn-db/js/ydn/db/io/query.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/io/key.js
] derived from ../ydn-db/js/ydn/db/io/key.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/core/storage.js
] derived from ../ydn-db/js/ydn/db/core/storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/tx_storage.js
] derived from ../ydn-db/js/ydn/db/tx_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/i_storage.js
] derived from ../ydn-db/js/ydn/db/i_storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/ydn/db/storage.js
] derived from ../ydn-db/js/ydn/db/storage.js
Cannot read [
/Users/jem/Dev/yathit/ydn/ydn-db/./../ydn-db/js/test.js
] derived from ../ydn-db/js/test.js

I'm not too concerned with running the tests at this time, but I wanted to point these things out in case they're useful. Hope this helps and thanks again! We're really impressed with the full-text search capabilities of this library!

yathit commented 10 years ago

Thanks James!

I will update when I have time. Glad that it works out for you.

yathit commented 10 years ago

Updated.