Tutorial :Why are my Lucene Document results empty?



Question:

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.


Solution:1

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


Solution:2

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


Solution:3

Read: http://anismiles.wordpress.com/2010/05/27/lucandra-an-inside-story/


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »