How to get the index last modification date ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to get the index last modification date ?

Jean-Claude Dauphin
Hello,

I need to check the index last modification date to count the number of
indexed terms only if tthe index has changed.

Any idea or suggestion on how to do this.

Thank you in advance.

Best wishes,

--
Jean-Claude Dauphin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the index last modification date ?

Ahmet Arslan

Hi Jean,
How about LukeRequest handler? Many of the information displayed on the admin screen comes from it.https://wiki.apache.org/solr/LukeRequestHandler

Ahmet
On Sunday, April 9, 2017, 2:21:38 AM GMT+3, Jean-Claude Dauphin <[hidden email]> wrote:
Hello,

I need to check the index last modification date to count the number of
indexed terms only if tthe index has changed.

Any idea or suggestion on how to do this.

Thank you in advance.

Best wishes,

--
Jean-Claude Dauphin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the index last modification date ?

Jean-Claude Dauphin
Thank you Ahmet for the suggestion.

I checked the LukeRequestHandler.java code source and the it looks like
this:

 String s = reader.getIndexCommit().getUserData().get(
SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
    if (s != null) {
      indexInfo.add("lastModified", new Date(Long.parseLong(s)));
    }

But this is the Solr code and not the Lucene code

public class SolrIndexWriter extends IndexWriter {
    ....

  /** Stored into each Lucene commit to record the
   *  System.currentTimeMillis() when commit was called. */
  public static final String COMMIT_TIME_MSEC_KEY = "commitTimeMSec";

And I don't find this map key into Lucene code. Otherwise I can test the
following code

     String s = indexReader.getIndexCommit().getUserData().get("
commitTimeMSec");
      if (s != null) {
                lastModified = new Date(Long.parseLong(s)).toString();
      }

Thanks again Ahmet,

Jean-Claude



On Sat, Apr 8, 2017 at 10:31 PM, Ahmet Arslan <[hidden email]>
wrote:

>
> Hi Jean,
> How about LukeRequest handler? Many of the information displayed on the
> admin screen comes from it.https://wiki.apache.org/solr/LukeRequestHandler
>
> Ahmet
> On Sunday, April 9, 2017, 2:21:38 AM GMT+3, Jean-Claude Dauphin <
> [hidden email]> wrote:
> Hello,
>
> I need to check the index last modification date to count the number of
> indexed terms only if tthe index has changed.
>
> Any idea or suggestion on how to do this.
>
> Thank you in advance.
>
> Best wishes,
>
> --
> Jean-Claude Dauphin
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the index last modification date ?

lukes
Can’t you introduce the field ? It should be straight forward, an every time you update the index, make sure to update the field. IndexWriter has setCommitData api, which you can call overtime you update/flush the indices.

> On Apr 8, 2017, at 2:30 PM, Jean-Claude Dauphin <[hidden email]> wrote:
>
> Thank you Ahmet for the suggestion.
>
> I checked the LukeRequestHandler.java code source and the it looks like
> this:
>
> String s = reader.getIndexCommit().getUserData().get(
> SolrIndexWriter.COMMIT_TIME_MSEC_KEY);
>    if (s != null) {
>      indexInfo.add("lastModified", new Date(Long.parseLong(s)));
>    }
>
> But this is the Solr code and not the Lucene code
>
> public class SolrIndexWriter extends IndexWriter {
>    ....
>
>  /** Stored into each Lucene commit to record the
>   *  System.currentTimeMillis() when commit was called. */
>  public static final String COMMIT_TIME_MSEC_KEY = "commitTimeMSec";
>
> And I don't find this map key into Lucene code. Otherwise I can test the
> following code
>
>     String s = indexReader.getIndexCommit().getUserData().get("
> commitTimeMSec");
>      if (s != null) {
>                lastModified = new Date(Long.parseLong(s)).toString();
>      }
>
> Thanks again Ahmet,
>
> Jean-Claude
>
>
>
> On Sat, Apr 8, 2017 at 10:31 PM, Ahmet Arslan <[hidden email]>
> wrote:
>
>>
>> Hi Jean,
>> How about LukeRequest handler? Many of the information displayed on the
>> admin screen comes from it.https://wiki.apache.org/solr/LukeRequestHandler
>>
>> Ahmet
>> On Sunday, April 9, 2017, 2:21:38 AM GMT+3, Jean-Claude Dauphin <
>> [hidden email]> wrote:
>> Hello,
>>
>> I need to check the index last modification date to count the number of
>> indexed terms only if tthe index has changed.
>>
>> Any idea or suggestion on how to do this.
>>
>> Thank you in advance.
>>
>> Best wishes,
>>
>> --
>> Jean-Claude Dauphin
>>

Loading...