| CARVIEW |
rnewson / couchdb-lucene
- Source
- Commits
- Network (16)
- Issues (6)
- Downloads (7)
- Graphs
-
Branch:
master
-
The resulting documents from a lucene-query, should be formatable using couch-db's _list API.
For instance with a URI like:
/database/_fti/lucene/_list/listname/lucene _idx_name?q=
Comments
-
It would be nice to have the default lucene-operator configurable per query or at least per design-document. Image you have two applications served from the same couchdb instance. In one you like OR as the default and in the other one AND. Or maybe you have different query-types...
Comments
-
I was just wondering, if it is possible to integrate local lucene to couchdb-lucene. If have not looked deeper into l-l, but it sounds very interesting. local lucene is available here: https://sourceforge.net/projects/locallucene/
Maybe I'll try to integrate local lucene to c-l myself, when I find the mood to dig into Java ;)
Comments
-
I'm having a crashing issue with CouchDB 0.10.0 and couchdb-lucene 0.4 on OS X 10.6.1.
Here's my local.ini: https://gist.github.com/231189
Here's the couch.log output: https://gist.github.com/231188I see something that might be the issue:
[Tue, 10 Nov 2009 19:24:53 GMT] [debug] [<0.5768.0>] OS Proc: Unknown info: {#Port<0.4098>, {data,{eol,<<"Error occurred during initialization of VM">>}}}
[Tue, 10 Nov 2009 19:24:53 GMT] [debug] [<0.5768.0>] OS Proc: Unknown info: {#Port<0.4098>, {data,{eol,<<"Unable to load native library: libjava.jnilib">>}}}
...but I can't tell how to go about fixing and/or troubleshooting this further.
Any help very much appreciated. Thank you!
Comments
Is this the same as https://github.com/rnewson/couchdb-lucene/issues#issue/15 ?
trevorturk
Tue Nov 10 11:50:55 -0800 2009
| link
I thought it might be, so I tried the workaround mentioned in the last comment, and it didn't help. Still, it might be related...? I can't tell for sure. One thing - "java -version" and "/usr/bin/java version" work for me, though.
trevorturk
Thu Nov 12 07:25:38 -0800 2009
| link
Here's the output, and some other possibly useful stuff: https://pastie.org/private/72c1wviyaujah9nefchxgq
I've disabled couchdb-lucene for now, as you can see. My coworker is telling me that I may need to switch to the couchdb user account and run java -version to make sure this is what's being used. I'm not sure how to accomplish this in OS X, but I'm on the hunt :)
also try the full command that you have there (with the -search bit and then again with the -index bit) as that user.
c-l on OSX has been a pain, which is why the JVM in 0.5 is launched externally. :)
trevorturk
Thu Nov 12 08:18:35 -0800 2009
| link
I think I've got something worth sharing...
I seem to be able to run the commands as the couchdb user, and there appear to be files written where they ought to be (?) - you can see what I mean in this pastie:
https://pastie.org/private/7y5y4rhtgpx0aqeollea
The first bit is me running commands as the couchdb user. The second bit is me showing no files in that directory, running the command, and then showing that files have been written.
I'm sorry - I don't know if this helps at all, but it's about the best I can do :)
assuming you have only a few documents, the index looks ok. So, at least the index process is working.
Is this helpful?: https://discussions.apple.com/thread.jspa?threadID=2089136
It ended up being libtiff, to my great surprise. Never would have guessed that one.
So, moral of the story, if your Java SE 6 doesn't work, check your DYLD_LIBRARY_PATH environment variable.
trevorturk
Thu Nov 12 09:06:45 -0800 2009
| link
As far as I can tell, the DYLD_LIBRARY_PATH isn't set. Any ideas about what it should be set to?
Is this still an issue? Sorry, I've been working on other projects for a while.
Hi, couchdb-lucene 0.5 (master) now supports 0.10 of couchdb and has received numerous bug fixes today. Please let me know if it works for you.
trevorturk
Tue Dec 22 06:57:08 -0800 2009
| link
I'll give it a shot and report back here. Thanks!
-
java.lang.ClassCastException: JSON keys must be strings.
2 comments Created 29 days ago by rollickI recently started getting this error which is preventing new document changes from being indexed. Any ideas??
Oh, and this is with couchdb 0.9.1 and couchdb-lucene 0.4.
[couchdb-lucene] ERROR Error updating index. java.lang.ClassCastException: JSON keys must be strings. at net.sf.json.JSONObject._fromJSONObject(JSONObject.java:1067) at net.sf.json.JSONObject.fromObject(JSONObject.java:177) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:108) at net.sf.json.JSONArray._processValue(JSONArray.java:2535) at net.sf.json.JSONArray.processValue(JSONArray.java:2593) at net.sf.json.JSONArray.addValue(JSONArray.java:2580) at net.sf.json.JSONArray.element(JSONArray.java:1753) at net.sf.json.JSONArray.fromObject(JSONArray.java:183) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:113) at net.sf.json.JSONObject._processValue(JSONObject.java:2759) at net.sf.json.JSONObject.processValue(JSONObject.java:2852) at net.sf.json.JSONObject.element(JSONObject.java:1891) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1175) at net.sf.json.JSONObject.fromObject(JSONObject.java:181) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:370) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1160) at net.sf.json.JSONArray.fromObject(JSONArray.java:149) at net.sf.json.util.JSONTokener.nextValue(JSONTokener.java:373) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1147) at net.sf.json.JSONObject._fromString(JSONObject.java:1337) at net.sf.json.JSONObject.fromObject(JSONObject.java:187) at net.sf.json.JSONObject.fromObject(JSONObject.java:156) at com.github.rnewson.couchdb.lucene.Database.getAllDocsBySeq(Database.java:87) at com.github.rnewson.couchdb.lucene.Index$Indexer.updateDatabase(Index.java:262) at com.github.rnewson.couchdb.lucene.Index$Indexer.updateIndex(Index.java:199) at com.github.rnewson.couchdb.lucene.Index$Indexer.run(Index.java:95) at java.lang.Thread.run(Thread.java:619)Comments
Sure.
function(doc) { if(doc.asset_type && !doc.stale) { var result = new Document(); function idx(obj, name, all) { var all = (all == null) ? true : all; if(obj) { switch (typeof obj) { case 'object': /*idx(obj[key]);*/ break; case 'function': break; default: result.add(obj, {'field': name}); if(all) result.add(obj); break; } } } /* for date conversion */ function pad(n) { /* returns string with leading 0 + n if n less than 10 or returns n */ return (n < 10) ? '0'+n : n; } /* general */ idx(doc.hostname, 'hostname'); idx(doc.asset_id, 'asset_id'); idx(doc.bu, 'bu'); idx(doc.asset_type, 'type'); idx(doc.comments, 'comments'); /* extra */ idx(doc['status'], 'status'); idx(doc.users, 'users'); idx(doc.wall_port, 'wall_port'); idx(doc['private'], 'private'); /* updated at/by info */ idx(doc['last_updated_by'], 'updated_by', false); if(doc.updated_at) { idx(doc.updated_at['data'], 'updated_at', false); } /* interfaces */ if(doc.interfaces) { for(iface in doc.interfaces) { idx(doc.interfaces[iface].mac_address, 'mac'); for(address in doc.interfaces[iface].ip_addresses) { ip_a = doc.interfaces[iface].ip_addresses[address]; idx(ip_a, 'ip'); } } } /* location */ if(doc.location) { idx(doc.location['site'], 'site'); idx(doc.location['room'], 'room'); idx(doc.location['building'], 'building'); } /* manufacturer */ if(doc.manufacturer) { idx(doc.manufacturer['serial'], 'serial'); idx(doc.manufacturer['make'], 'make'); idx(doc.manufacturer['model'], 'model'); } /* specifications */ if(doc.specifications) { idx(doc.specifications['memory'], 'memory'); idx(doc.specifications['cpu_speed'], 'cpu_speed'); idx(doc.specifications['cpu_type'], 'cpu_type'); } /* os */ if(doc.os) { idx(doc.os['type'], 'os'); idx(doc.os['version'], 'os_version'); } /* purchase */ if(doc.purchase_info) { if(doc.purchase_info['warranty_expiry']) { var date = new Date(doc.purchase_info['warranty_expiry']['data']); f_date = date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()); idx(f_date, 'warranty_expiry', false); } /* idx(doc.purchase_info['warranty_expiry'], 'warranty'); */ idx(doc.purchase_info['supplier'], 'supplier'); idx(doc.purchase_info['price'], 'price'); idx(doc.purchase_info['invoice_number'], 'invoice'); if(doc.purchase_info['purchase_date']) { var date = new Date(doc.purchase_info['purchase_date']['data']); f_date = date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()); idx(f_date, 'purchase_date', false); } /* idx(doc.purchase_info['purchase_date'], 'purchase_date'); */ idx(doc.purchase_info['po_number'], 'po'); } /* Switch port details */ if(doc.switch_ports) { for(sp in doc.switch_ports) { idx(doc.switch_ports[sp]['status'], 'sp_status', false); idx(doc.switch_ports[sp]['type'], 'sp_type', false); idx(doc.switch_ports[sp]['port'], 'sp_port', false); idx(doc.switch_ports[sp]['notes'], 'sp_notes', false); idx(doc.switch_ports[sp]['port_id'], 'sp_port_id', false); idx(doc.switch_ports[sp]['vlan'], 'sp_vlan', false); } } /* Software details */ if(doc.installed_software) { for(sw in doc.installed_software) { idx(doc.installed_software[sw]['name'], 'sw_name', false); idx(doc.installed_software[sw]['version'], 'sw_version', false); idx(doc.installed_software[sw]['license'], 'sw_license', false); idx(doc.installed_software[sw]['comments'], 'sw_comments', false); } } if(doc.optional_fields) { for(of in doc.optional_fields) { if(doc.optional_fields[of]['name']) { name = doc.optional_fields[of]['name'].replace(\/\\s\/g, '_').toLowerCase(); idx(doc.optional_fields[of]['value'], name, false); } } } /* services */ if(doc.services) { for(service in doc.services) { idx(doc.services[service], 'service', false); } } /* asset watch */ if(doc.watch) { if(doc.watch['all']) { idx(true, 'watch', false); } else { idx(false, 'watch', false); } } /* result.add({'field':'indexed_at'}); */ return result; } } -
Hi,
I'm using couchdb-lucene 0.5 as of today (01-07-2010) and couchdb 0.10.
When couchdb-lucene is indexing my documents, during the first access of the view I'm getting a TypeError exception that's preventing the document to be indexed:
2010-01-07 23:45:08,859 WARN couchdb.lucene.ViewIndexer.localhost/5984/knownet/bag/knsearch 16bb3f66e8d4c88d11b4e5c092ba38ab caused TypeError: Cannot find default value for object. (unnamed script#37)
I modified the DocumentConverterTest.java class to using my documents and my functions and the exception is still being thrown:
marcosvm@pepita:~/Servers/couchdb-lucene-0.5-SNAPSHOT $ jruby document_converter_test.rb
Loaded suite document_converter_test
Started
E
Finished in 0.258 seconds.1) Error: test_document_conversion(DocumentConverterTest):
NativeException: org.mozilla.javascript.EcmaError: TypeError: Cannot find default value for object. (single#49)
org/mozilla/javascript/ScriptRuntime.java:3654:in `constructError' org/mozilla/javascript/ScriptRuntime.java:3632:in `constructError' org/mozilla/javascript/ScriptRuntime.java:3660:in `typeError' org/mozilla/javascript/ScriptRuntime.java:3672:in `typeError1' org/mozilla/javascript/ScriptableObject.java:781:in `getDefaultValue' org/mozilla/javascript/ScriptableObject.java:700:in `getDefaultValue' org/mozilla/javascript/ScriptRuntime.java:724:in `toString' org/mozilla/javascript/ScriptRuntime.java:3741:in `notFunctionError' org/mozilla/javascript/ScriptRuntime.java:2247:in `getPropFunctionAndThisHelper' org/mozilla/javascript/ScriptRuntime.java:2214:in `getPropFunctionAndThis' org/mozilla/javascript/gen/single:49:in `_c0' org/mozilla/javascript/gen/single:-1:in `call' org/mozilla/javascript/ContextFactory.java:398:in `doTopCall' org/mozilla/javascript/ScriptRuntime.java:3065:in `doTopCall' org/mozilla/javascript/gen/single:-1:in `call' com/github/rnewson/couchdb/lucene/DocumentConverter.java:59:in `convert' document_converter_test.rb:23:in `test_document_conversion'1 tests, 0 assertions, 0 failures, 1 errors
I'm not sure how to provide this default value required by Rhino or if it's an actual bug during the document conversion.
I put a copy of the function and one document here: https://gist.github.com/271912
Any help would be appreciated.
Thanks is advance,
MarcosComments
I think it's a bug in your function but I can't see it. Rhino doesn't need any default values injected, so it's probably an obscurly reported Javascript problem.





+1 :^D This would be really useful for the app I'm currently working on...
this would be totally sweet. what would it take to do this? i'd like to help out if possible.