lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Benedetti <benedetti.ale...@gmail.com>
Subject Re: can I ?
Date Tue, 21 Jul 2015 11:46:40 GMT
Hi Yechiel,
if you refers to the same java object instances ( i.e. the same object,
identified by the same reference in the heap space), the answer is no.

The document you send to Lucene to be added to index is a different Object
type from the one you can retrieve from a  searcher.

You can index a  *Document* ( org.apache.lucene.document.Document ) and
retrieve from the Searcher a *TopDocs* ( org.apache.lucene.search.TopDocs)
that is a collection of *ScoreDoc* (org.apache.lucene.search.ScoreDoc ) .

The scoreDoc simply contains the id of the document and the score.
After you have the Id, you can use your IndexSearcher to actually get the
stored values for your Document.

Getting the *StoredDocument*(org.apache.lucene.index.StoredDocument).

Remember that to retrieve the values for original ( not analysed ) field
content at search time, you need to have that field to be stored.
You first need to build at indexing time an additional data structure,
containing the stored content for the fields.
I hope this clarifies your doubts.

Cheers


2015-07-21 12:09 GMT+01:00 Yechiel Feffer <yechielf@gigaspaces.com>:

> Hi
> I am new to Lucene so-
> Can I get from search the same documents (i.e. same java object instances)
> that I used in my add command to the index?
>
> Thnx
> Yechiel
>



-- 
--------------------------

Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message