Hi,
It's a local IndexSearcher.
I have done a lot of tests and it's really happening.
Let me give you a little more details, maybe this helps:
- I call a function that creates a new IndexSearcher and call $hits = $searcher
-> hits.
- I iterate over the first few entries and returns the entries and the $hits
- The documents that were found are deleted from a database, which in turn
deletes the documents from the Lucy index.
- Now I iterate over the next few entries and delete them and so on
I have made small test where per iteration only two entries are fetch. The
result looks like this:
id => "8b8bce64e69b52ed244671009c11ee0e",
id => "8b8bce64e69b52ed244671009c4857e7",
id => "4a3dcd6c2e9e3074d2d52b8e72584b68",
id => "8b8bce64e69b52ed244671009c730dc9",
id => "4a3dcd6c2e9e3074d2d52b8e72584d19",
id => "8b8bce64e69b52ed244671009c7e3974",
id => "4a3dcd6c2e9e3074d2d52b8e72585475",
id => "8b8bce64e69b52ed244671009c7e4788",
id => "4a3dcd6c2e9e3074d2d52b8e72585dc2",
id => "8b8bce64e69b52ed244671009c7e2fa6",
id is some value I store in the document. The result should only contain ids
starting with 8.
So you see the first two are correct, after deletion of this two (always in a
different process), the next time, the first one I get is wrong the second one
is correct...
If I do not delete anything I only get the right entries (just commented out
one line the rest is still the same).
Any clue?
Thanks & Regards
Gerald
-----Ursprüngliche Nachricht-----
Von: Marvin Humphrey [mailto:[email protected]]
Gesendet: Donnerstag, 19. November 2015 12:19
An: [email protected]
Betreff: Re: [lucy-user] Strange results when documents gets delete while
iterating
On Wed, Nov 18, 2015 at 10:22 PM, Gerald Richter <[email protected]> wrote:
> I have a simple query that consists of a TermQuery and a RangeQuery, I am
> iterating over this query like this:
>
> while ($cnt-- >= 0 && ($hit = $hits -> next))
> {
> $data = $hit->get_fields() ;
> ....
> }
>
> While this loop runs documents are deleted from the index by another
> process. Without this other process everything is fine. When this deletion
> is happeing, it seems that half of the documents that are returned by $hits
> -> next are wrong, which mean I get a totaly different document, which
> should not be part of the resultset.
>
> I thought that a searcher operates on a snapshot, so changes that happens at
> the same time does not influence the query. Is this wrong? If yes, how could
> I make sure my resultset is not corrupted?
What kind of a Searcher is this? If it's an IndexSearcher operating
on a local index, I don't see how it could happen. But if it's a
ClusterSearcher, then it would be possible if the remotes are being
refreshed.
Marvin Humphrey
!DSPAM:416,564db01923795029453755!