apache / nano

Nano is now part of Apache CouchDB. Repo moved to https://GitHub.com/apache/couchdb-nano
https://github.com/apache/couchdb-nano
Other
1.12k stars 157 forks source link

Couchdb-lucene support / interoperability with Cloudant #263

Open homerjam opened 9 years ago

homerjam commented 9 years ago

Hi,

I've been using pouchdb with a plugin to allow couchdb-lucene to be used locally and cloudant in production - I presume this could be done by extending nano.

However as both extensions are very popular would you consider adding dedicated support for couchdb-lucene also? It would be nice to have a clean, maintained implementation.

Thanks

dscape commented 9 years ago

Would consider it, can you propose how this would look like in your view?

homerjam commented 9 years ago

I guess something like:

// usage

var nano = require('nano');

var db = nano({
    url: 'http://localhost:5984/foo',
    searchVendor: nano.CLOUDANT_SEARCH || nano.LUCENE_SEARCH
);

// in nano.js

// declare constants (after line 12)
nano.CLOUDANT_SEARCH = 'cloudant';
nano.LUCENE_SEARCH = 'lucene';

// choose viewPath style (around 474)
var viewPath;

if (meta.type === 'search' && cfg.searchVendor === nano.LUCENE_SEARCH) {
    viewPath = '/_fti/local/' + dbName + '/_design/' + ddoc + '/' + viewName;
} else {
    viewPath = '_design/' + ddoc + '/_' + meta.type + '/'  + viewName;
}

The trouble is that couchdb-lucene uses a different path - normally the database name is at the start but instead it comes after the /_fti/local/ prefix. So this would require some further modification in the relax() function I think.

homerjam commented 9 years ago

I've had a go at this in #272

carlosduclos commented 7 years ago

I know this is kinda latte now, but this repository has been merged into apache/couchdb-nano. Could you move your pull request there? I will create an issue there referencing this one. Here is the new issue for tracking.