views:

172

answers:

3

I'm running a simple test--trying to index something and then search for it. I index a simple document, but then when a search for a string in it, I get back what looks to be an empty document (it has no fields). Lucene seems to be doing something, because if I search for a word that's not in the document, it returns 0 results.

Any reason why Lucene would reliably return a document when it finds one that matches the given query, and yet that document has nothing in it?

More details:

  • I'm actually running Lucandra (Lucene + Cassandra). That certainly may be a relevant detail, but not sure.

  • The fields are set to Field.Store/YES and Field.Index/ANALYZED

  • Interestingly, I'm able to get this to work just fine on my local machine, but when we put it on our main server (which is a multi-node cassandra setup), I get the behavior described above. So this seems like probably the relevant detail, but unfortunately, I see no error message to clue me in to what specifically is causing it.
A: 

It's hard to tell what the problem is since you only provide a very abstract description. However, it sounds a bit like you are not storing the field value in the index. There are different modes for indexing a field. One option determines whether the original value is stored in the index to retrieve it later:

http://lucene.apache.org/java/3_0_0/api/core/org/apache/lucene/document/Field.Store.html

See also the description of the enclosing class Field

lex82
Thanks, I realize I only gave an abstract description. And that's because this is implemented in a clojure wrapper around Lucandra which is a way of using Lucene with Clojure.As for the field store, unfortunately I am using Field.Store/YES so that's not the problem. I'll update the original question now, however, with this and some other information. Thanks!
vegashacker
A: 

Unsure if this will work with Lucandra, but you have tried opening the index using Luke? Viewing the index contents with Luke might help

Mikos