When updating object_count in ezsearch_word, eZSearchEngine splits the list of words in chunks of 500. But in every cycle of the loop not only the current chunk but all of the previous chunks are incremented. Which means that if there are, lets say 3 chunks, the first chunk gets an increment of +3, the second of +2, and the third of +1.
Steps to reproduce:
1. Create a new object with an attribute that has (plenty) more than 500 indexable words.
2. Pick any word that is mentioned at the beginning of that attribute.
3. Publish the object
4. Find that word in ezsearch_word and watch the object_count value.
5. Edit the object created in step 1 and publish it without modifying it.
6. Find again the word in ezsearch_word and watch the object_count value.
The object_count has a larger value than it should.
Pull request here: https://github.com/ezsystems/ezpublish-legacy/pull/1319