reader.document(i) and searcher.doc(i) do the same thing: retrieve the
stored fields.

But neither method fully preserves indexing information; e.g., boosts
are lost, details about how the field was indexed (e.g., DOCS_ONLY,
et.c) are lost, etc.

You can use the returned document to provide the values (strings,
numbers) you want to index, but then you must re-assert your own
schema by building a new document with Fields set up for indexing as
you originally did, carrying over just the values you retrieved from
the stored document.

Mike McCandless

http://blog.mikemccandless.com


On Tue, May 13, 2014 at 6:12 PM, Jamie <ja...@mailarchiva.com> wrote:
> Mike
>
> Thanks for the tip. The doc was being loaded using the method
> searcher.doc(scoreDoc.doc,getLoadFields()). Obviously, only a minority of
> fields were being loaded. However, when using the method
> searcher.doc(scoreDoc.doc), the doc appears to update when
> updateDocument(term,doc) is called. Can you confirm whether the full
> document will be returned when I call searcher.doc(scoreDoc.doc)? if not,
> what is the recommended way to get the original document from the index (if
> possible)? Perhaps, reader.document(i)?
>
> Thanks in advance
>
> Jamie
>
>
> On 2014/05/13, 3:30 PM, Michael McCandless wrote:
>>
>> How did you produce the document that you are sending to
>> updateDocument?  Are you loading it from IndexReader.document() or
>> IndexSearcher.doc(), changing it, then passing that to
>> IW.updateDocument?  If so, that's probably your bug: a loaded document
>> is not identical to the original Document you indexed.  In 5.0 we've
>> fixed this to be strongly typed ...
>>
>> Mike McCandless
>>
>> http://blog.mikemccandless.com
>>
>>
>> On Tue, May 13, 2014 at 9:24 AM, Jamie <ja...@mailarchiva.com> wrote:
>>>
>>> Greetings
>>>
>>> I am using Lucene NRT search. After calling writer.updateDocument(term,
>>> doc)
>>> and then search(), the document is no longer visible in the search
>>> results.
>>> The program must be restarted to see it again. In addition, the update is
>>> not being applied. The original document (before the update) is visible
>>> in
>>> the search results. If updateDocument(term,doc) is called, passing the
>>> original doc (without any changes), the doc is still removed from the
>>> index
>>> (i.e. the change is not the cause). On each search I am calling
>>> indexReader
>>> = DirectoryReader.open(writer, true); We have tried to call commit()
>>> and/or
>>> close() immediately after the update, but it makes no difference.
>>>
>>> This occurs both in Lucene 4.7.2 and 4.8. As far as we know, our code
>>> used
>>> to work with prior versions of Lucene. Has anyone encountered this?
>>>
>>> Regards
>>>
>>> Jamie
>>>
>>>
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to