# Emerse-solr-plugin-7.0.0-alpha1.jar returning old stats data

**URL:** <https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113>\
**Category:** Uncategorized\
**Created:** [March 26, 2024, 8:32pm UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113 "2024-03-26T20:32:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricMeeks](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@EricMeeks](https://discourse.project-emerse.org/u/EricMeeks)\
**Post date:** [March 26, 2024, 8:32pm UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113/1 "2024-03-26T20:32:19Z")

</div>

Normally this wouldn’t matter, but we had some documents in our index that had ENCOUNTER\_DATE’s that were in the future. It was only 41 in total, and the worst one was in 3017-11-17T00:25:00Z.  
This breaks EMERSE because Hibernate rejects this as a valid date when it does its “Update document statistics…” work, which you can force from the Admin-\>System screen.  
So I cleared out the bad documents, and when I use SOLR to check that the dates are all now reasonable all looks good. However, the EMERSE call to …/documents/index-stats which calls into this jar still shows the old data. I tested this with POSTMAN and this is what I see when I do command=minMax, df=ECOUNTER\_DATE:  
{  
“responseHeader”: {  
“status”: 0,  
“QTime”: 1  
},  
“min”: “1899-01-11T16:00:00Z”,  
“max”: “3017-11-17T00:25:00Z”  
}

Is there a way to get this to reset?

---

<div class="post-metadata">

**Author:** ![mcclaink](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.project-emerse.org/mcclaink/32/8_2.png) [@mcclaink](https://discourse.project-emerse.org/u/mcclaink)\
**Post date:** [March 26, 2024, 9:34pm UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113/2 "2024-03-26T21:34:44Z")

</div>

Yeah, so it looks like we don’t ignore “deleted” documents when calculating the min and max date. When documents are deleted, they are really just marked for deletion, and are ignored in searches etc, but when we coded the min-max endpoint, we didn’t check to see if the documents that have the min and max dates weren’t deleted.

We can fix this, but there’s another thing you can do which makes the bug less of an issue, which is that there’s a setting in EMERSE that will only update the end date of the index to at most today, that way if there’s any future data, it won’t push the index’s end date past today. If you want to use that, you need to set:

```
batch.updateIndexMaxDateFromSOLRIndexPastToday=false

```

in the `emerse.properties` file and restart the server.

---

<div class="post-metadata">

**Author:** ![EricMeeks](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@EricMeeks](https://discourse.project-emerse.org/u/EricMeeks)\
**Post date:** [March 27, 2024, 12:16am UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113/3 "2024-03-27T00:16:04Z")

</div>

> [@mcclaink](#):
>
> `batch.updateIndexMaxDateFromSOLRIndexPastToday=false`

Thanks, and that worked! Unfortunately the min date time is also illegal! I’ll code something up to fix this temporarily.  
Thanks,  
Eric

---

<div class="post-metadata">

**Author:** ![mcclaink](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.project-emerse.org/mcclaink/32/8_2.png) [@mcclaink](https://discourse.project-emerse.org/u/mcclaink)\
**Post date:** [April 12, 2024, 2:52pm UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113/4 "2024-04-12T14:52:46Z")

</div>

So, it doesn’t look like there’s a good way to fix the Solr plugin to ignore deleted documents while still being very fast, which was the intention of the plugin there. However, I forgot we also have another property you can set that might fix your second problem:

```auto
batch.updateIndexMinDateFromSOLRIndex=false

```

This will completely disable changing the min date, so you can set it once in the DB, and then it’ll stay that way.

---

<div class="post-metadata">

**Author:** ![EricMeeks](https://avatars.discourse-cdn.com/v4/letter/e/5f8ce5/32.png) [@EricMeeks](https://discourse.project-emerse.org/u/EricMeeks)\
**Post date:** [April 12, 2024, 3:38pm UTC](https://discourse.project-emerse.org/t/emerse-solr-plugin-7-0-0-alpha1-jar-returning-old-stats-data/113/5 "2024-04-12T15:38:54Z")

</div>

Thanks! And yep, I found that property and used it exactly that way.

Eric
