Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion ZoieSegmentReader.getUID maybe throws exceptioin

Received: by 10.180.98.70 with SMTP id eg6mr432910wib.2.1325778851665;
        Thu, 05 Jan 2012 07:54:11 -0800 (PST)
X-BeenThere: zoie@googlegroups.com
Received: by 10.227.151.11 with SMTP id a11ls54407508wbw.0.gmail; Thu, 05 Jan
 2012 07:54:10 -0800 (PST)
Received: by 10.216.131.91 with SMTP id l69mr176249wei.1.1325778850586;
        Thu, 05 Jan 2012 07:54:10 -0800 (PST)
Received: by 10.216.131.91 with SMTP id l69mr176248wei.1.1325778850558;
        Thu, 05 Jan 2012 07:54:10 -0800 (PST)
Return-Path: <john.w...@gmail.com>
Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181])
        by gmr-mx.google.com with ESMTPS id hv1si550541wib.1.2012.01.05.07.54.10
        (version=TLSv1/SSLv3 cipher=OTHER);
        Thu, 05 Jan 2012 07:54:10 -0800 (PST)
Received-SPF: pass (google.com: domain of john.w...@gmail.com designates 74.125.82.181 as permitted sender) client-ip=74.125.82.181;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of john.w...@gmail.com designates 74.125.82.181 as permitted sender) smtp.mail=john.w...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-we0-f181.google.com with SMTP id m12so541420wer.12
        for <zoie@googlegroups.com>; Thu, 05 Jan 2012 07:54:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :content-type;
        bh=0uLBaGKgF2ww77FGE/RDequXz2QIzPhGDQwy8y4d45k=;
        b=CcQJJ6uZIB0aJLVVEIWrQQCy1YwT0xmxipEB56vmsss8hqoCJigbFYO2dfMC6ZjGix
         +y367zhJdGD7f4I7Vsz8nnm6YuTGU2dT7u+Q8Pl8pje7PtZEyrZWXWyfSQ1CzW522JFf
         TqOJ1nZBNSrVq0OiGzaZTsHMXng3E2GcJ3mR8=
MIME-Version: 1.0
Received: by 10.216.134.149 with SMTP id s21mr1213222wei.41.1325778850384;
 Thu, 05 Jan 2012 07:54:10 -0800 (PST)
Received: by 10.216.4.16 with HTTP; Thu, 5 Jan 2012 07:54:10 -0800 (PST)
In-Reply-To: <9371819c-eac6-4a4a-a436-2dd3d3385825@m20g2000vbf.googlegroups.com>
References: <05a68844-0980-47ac-84cd-6480947a9da3@d6g2000pra.googlegroups.com>
	<CAK3ZUu+HLOJP9-TmqUoATPzZYLrysOOJXrqy4udo8e_RODe...@mail.gmail.com>
	<cc2a5870-2a71-4104-b0e2-233649686...@q7g2000prl.googlegroups.com>
	<5d088183-4e9d-40bf-8ad4-0dfc0c700...@s10g2000prj.googlegroups.com>
	<CAK3ZUuKsGMToa0sOZ-p0VY_wqf4biap+b6Qh4+7kJRfY8kh...@mail.gmail.com>
	<CAEkdZG9N728Rq7mHOcc=2JSJcfEpG2HWd-RJoJ4nnOFcQJ1...@mail.gmail.com>
	<CAK3ZUu+evkXVce3ztHB_wwbnS7nRUjzRRSubGtOe4hY852b...@mail.gmail.com>
	<CAEkdZG9HzhptD8N7etZz6Z3Udc-=OK52R7auMoDdxe5sURQ...@mail.gmail.com>
	<CAK3ZUu+r-9ggKH0sHNW4g6EG-DHtEjbVEynDgTHdo5sjjU2...@mail.gmail.com>
	<9371819c-eac6-4a4a-a436-2dd3d3385...@m20g2000vbf.googlegroups.com>
Date: Thu, 5 Jan 2012 07:54:10 -0800
Message-ID: <CAK3ZUuLpe_2BkCDVonrVDpsfrPQSgj3HMqxip+7EOhE3FZL...@mail.gmail.com>
Subject: Re: [zoie] Re: ZoieSegmentReader.getUID maybe throws exceptioin
From: John Wang <john.w...@gmail.com>
To: zoie@googlegroups.com
Content-Type: multipart/alternative; boundary=0016e6dd990d6d8b2904b5c9f19f

--0016e6dd990d6d8b2904b5c9f19f
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

You are right! Thank you.

https://github.com/javasoze/zoie/blob/master/zoie-solr/src/main/java/proj/z=
oie/solr/ZoieUpdateHandler.java

Will do a snapshot deploy today.

Master is upgraded with lucene 3.5.0 btw.

-John

2012/1/4 genuine <yzygenu...@gmail.com>

> I saw the soure,but it has not change :
> // long uid =3D zoieReader.getUID(doc + base);
>   long uid =3D zoieReader.getUID(doc);
>
> The zoieReader is refer the ZoieSegmentReader, not ZoieMultiReader,so
> doc doesn't need to add base.
>
> On Dec 30 2011, 12:30 am, John Wang <john.w...@gmail.com> wrote:
> > Oh. I think yo uare using a very old jar.
> >
> > See source at:
> >
> > https://github.com/javasoze/zoie/blob/master/zoie-solr/src/main/java/..=
.
> >
> > So your change is definitely correct :)
> >
> > We will do a release shortly, stay tuned :)
> >
> > -John
> >
> > 2011/12/27 Gino Yu <yzygenu...@gmail.com>
> >
> >
> >
> >
> >
> >
> >
> > > That's I change the source..
> >
> > >   // long uid =3D zoieReader.getUID(doc + base);
> > >    long uid =3D zoieReader.getUID(doc);
> > > I change it at deleteByQuery.And it work,but I can't sure it ..
> >
> > > =D4=DA 2011=C4=EA12=D4=C227=C8=D5 =CF=C2=CE=E711:34=A3=ACJohn Wang <j=
ohn.w...@gmail.com>=D0=B4=B5=C0=A3=BA
> >
> > > Is there a question or comment related to this post?
> >
> > >> -John
> >
> > >> 2011/12/27 Gino Yu <yzygenu...@gmail.com>
> >
> > >>> package proj.zoie.solr;
> >
> > >>> import it.unimi.dsi.fastutil.longs.LongArrayList;
> > >>> import it.unimi.dsi.fastutil.longs.LongList;
> >
> > >>> import java.io.IOException;
> > >>> import java.net.URL;
> > >>> import java.util.ArrayList;
> > >>> import java.util.Arrays;
> > >>> import java.util.List;
> > >>> import java.util.concurrent.Future;
> >
> > >>> import org.apache.log4j.Logger;
> > >>> import org.apache.lucene.document.Document;
> > >>> import org.apache.lucene.index.IndexReader;
> > >>> import org.apache.lucene.index.MultiReader;
> > >>> import org.apache.lucene.search.Collector;
> > >>> import org.apache.lucene.search.IndexSearcher;
> > >>> import org.apache.lucene.search.Query;
> > >>> import org.apache.lucene.search.Scorer;
> > >>> import org.apache.lucene.store.Directory;
> > >>> import org.apache.solr.common.SolrException;
> > >>> import org.apache.solr.common.util.NamedList;
> > >>> import org.apache.solr.common.util.SimpleOrderedMap;
> > >>> import org.apache.solr.core.SolrConfig;
> > >>> import org.apache.solr.core.SolrCore;
> > >>> import org.apache.solr.search.QueryParsing;
> > >>> import org.apache.solr.update.AddUpdateCommand;
> > >>> import org.apache.solr.update.CommitUpdateCommand;
> > >>> import org.apache.solr.update.DeleteUpdateCommand;
> > >>> import org.apache.solr.update.MergeIndexesCommand;
> > >>> import org.apache.solr.update.RollbackUpdateCommand;
> > >>> import org.apache.solr.update.UpdateHandler;
> >
> > >>> import proj.zoie.api.DataConsumer.DataEvent;
> > >>> import proj.zoie.api.DocIDMapper;
> > >>> import proj.zoie.api.Zoie;
> > >>> import proj.zoie.api.ZoieException;
> > >>> import proj.zoie.api.ZoieIndexReader;
> > >>> import proj.zoie.api.indexing.IndexingEventListener;
> > >>> import proj.zoie.impl.indexing.ZoieSystem;
> >
> > >>> public class ZoieUpdateHandler extends UpdateHandler {
> > >>>     private static Logger log =3D
> > >>> Logger.getLogger(ZoieUpdateHandler.class);
> >
> > >>>     private SolrCore _core;
> >
> > >>>     /**
> > >>>      * =BC=E4=B8=F4=B6=E0=B3=A4=CA=B1=BC=E4=D6=D8=D0=C2=B4=F2=BF=AA=
searcher,=C4=AC=C8=CF=D6=B5=CA=C7=D2=BB=B7=D6=D6=D3
> > >>>      */
> > >>>     private static long intervalTime =3D 1000 * 60;// =D2=BB=B7=D6=
=D6=D3
> >
> > >>>     private Directory indexDir;
> >
> > >>>     private Zoie<IndexReader, DocumentWithID> zoie;
> > >>>     /**
> > >>>      * =BC=C7=C2=BC=D7=EE=BA=F3=D2=BB=B8=F6=B0=E6=B1=BE
> > >>>      */
> > >>>     private String lastVersion;
> >
> > >>>     public ZoieUpdateHandler(SolrCore core) {
> > >>>         super(core);
> > >>>         _core =3D core;
> > >>>         SolrConfig solrConfig =3D _core.getSolrConfig();
> > >>>         try {
> > >>>             indexDir =3D
> > >>> _core.getDirectoryFactory().open(solrConfig.getDataDir());
> > >>>         } catch (Exception e) {
> > >>>             log.error("", e);
> > >>>         }
> > >>>         long interval =3D
> > >>> solrConfig.getInt("solrIndexSearcher.reopen.batchDelay", (int)
> > >>> intervalTime);
> > >>>         intervalTime =3D interval;
> > >>>         log.info("intervalTime=A3=BA" + intervalTime + "
> > >>> ,=BC=E4=B8=F4=CA=B1=BC=E4=D6=D8=D0=C2=B4=F2=BF=AASolrIndexSearcher"=
);
> > >>>         ZoieSystemHome zoieHome =3D ZoieSystemHome.getInstance(_cor=
e);
> > >>>         if (zoieHome =3D=3D null) {
> > >>>             log.error("zoie home is not setup");
> > >>>             throw new RuntimeException("zoie is not setup");
> > >>>         }
> > >>>         zoie =3D zoieHome.getZoieSystem();
> > >>>         if (zoie =3D=3D null) {
> > >>>             log.error("zoie is not setup");
> > >>>             throw new RuntimeException("zoie is not setup");
> > >>>         }
> > >>>         lastVersion =3D zoie.getCurrentReaderVersion();
> > >>>         log.info
> ("#######################################################################=
####"
> > >>> + lastVersion);
> > >>>         runOpenSolrIndexSearcher();
> > >>>         log.info("=B3=F5=CA=BC=BB=AF=BD=E1=CA=F8");
> >
> > >>>         ZoieSystem _zoie =3D (ZoieSystem) zoie;
> > >>>         _zoie.addIndexingEventListener(new IndexingEventListener() =
{
> > >>>             @Override
> > >>>             public void handleIndexingEvent(IndexingEvent evt) {
> > >>>                 log.info(" ###########=CB=A2=CA=FD=BE=DD=B5=BD=D3=
=B2=C5=CC=B5=C4=CA=C2=BC=FE ###########");
> > >>>             }
> >
> > >>>             @Override
> > >>>             public void handleUpdatedDiskVersion(String version) {
> > >>>                 log.info("indexingEventListener update
> > >>> version###########");
> > >>>             }
> > >>>         });
> > >>>     }
> >
> > >>>     /**
> > >>>      * =BC=E0=BF=D8=CA=C7=B7=F1=D6=D8=D0=C2=B4=F2=BF=AAsearcher
> > >>>      */
> > >>>     private void runOpenSolrIndexSearcher() {
> > >>>         log.info("=D7=BC=B1=B8=C6=F4=B6=AF=BC=E0=BF=D8=D6=D8=D0=C2=
=B4=F2=BF=AAsolrIndexSearcher=B5=C4=CF=DF=B3=CC=A1=A3=A1=A3");
> > >>>         Thread thread =3D new Thread() {
> > >>>             public void run() {
> > >>>                 try {
> > >>>                     log.info("=D0=DD=CF=A210=C3=EB=A1=A3=A1=A3");
> > >>>                     Thread.sleep(10000);
> > >>>                 } catch (Exception e) {
> > >>>                     log.error("", e);
> > >>>                 }
> > >>>                 try {
> > >>>                     while (true) {
> > >>>                         log.info("=D0=DD=CF=A2" + intervalTime + " =
 =BA=C1=C3=EB=A1=A3=A1=A3");
> > >>>                         Thread.sleep(intervalTime);
> > >>>                         boolean hasChange =3D readerHasChange();
> > >>>                         log.info
> ("reader=CA=C7=B7=F1=D3=D0=D0=DE=B8=C4=B9=FD############################:=
"
> > >>> + hasChange);
> > >>>                         if (hasChange) {
> > >>>                             log.info("=D6=D8=D0=C2=B4=F2=BF=AAsolrI=
ndexSearcher");
> > >>>                             try {
> > >>>                                 updateReader(false);
> > >>>                             } catch (Exception e) {
> > >>>                                 log.error("", e);
> > >>>                             }
> > >>>                         }
> > >>>                         log.info("=D0=DD=CF=A2");
> > >>>                     }
> > >>>                 } catch (Exception e) {
> > >>>                     log.error("", e);
> > >>>                 }
> > >>>             }
> > >>>         };
> > >>>         thread.start();
> > >>>         log.info("=C6=F4=B6=AF=BC=E0=CC=FD=CF=DF=B3=CC");
> > >>>     }
> >
> > >>>     /**
> > >>>      * =BC=EC=B2=E2reader=CA=C7=B7=F1=D3=D0=D0=DE=B8=C4=A3=AC=C8=E7=
=B9=FB=D3=D0=D0=DE=B8=C4=D6=D8=D0=C2new searcher
> > >>>      *
> > >>>      * @return
> > >>>      * @throws Exception
> > >>>      */
> > >>>     private boolean readerHasChange() throws Exception {
> > >>>         String version =3D zoie.getCurrentReaderVersion();
> > >>>         log.info
> ("###########################################version:"
> > >>> + version);
> > >>>         if (version =3D=3D null) {
> > >>>             return false;
> > >>>         }
> > >>>         if ((version !=3D null && lastVersion =3D=3D null) ||
> > >>> version.compareTo(lastVersion) > 0) {
> > >>>             lastVersion =3D version;
> > >>>             return true;
> > >>>         } else {
> > >>>             return false;
> > >>>         }
> > >>>     }
> >
> > >>>     @Override
> > >>>     public int addDoc(AddUpdateCommand cmd) throws IOException {
> > >>>         if (zoie =3D=3D null) {
> > >>>             throw new IOException("zoie is not setup");
> > >>>         }
> > >>>         // String id =3D cmd.getIndexedId(_core.getSchema());
> > >>>         String uid2 =3D (String)
> > >>> cmd.solrDoc.getFieldValue(idField.getName());
> > >>>         long zoieUid;
> > >>>         try {
> > >>>             zoieUid =3D Long.parseLong(uid2);
> > >>>         } catch (Exception e) {
> > >>>             throw new IOException("index uid must exist and of type
> > >>> long: " + uid2);
> > >>>         }
> > >>>         Document doc =3D cmd.doc;
> > >>>         long time =3D System.currentTimeMillis();
> > >>>         String version =3D String.valueOf(time);
> > >>>         DataEvent<DocumentWithID> event =3D new
> > >>> DataEvent<DocumentWithID>(new DocumentWithID(zoieUid, doc), version=
);
> > >>>         try {
> > >>>             zoie.consume(Arrays.asList(event));
> > >>>             return 1;
> > >>>         } catch (ZoieException e) {
> > >>>             log.error("", e);
> > >>>             throw new IOException(e.toString());
> > >>>         }
> > >>>     }
> >
> > >>>     @Override
> > >>>     public void close() throws IOException {
> > >>>         ZoieSystemHome zoieHome =3D ZoieSystemHome.getInstance(_cor=
e);
> > >>>         if (zoieHome !=3D null) {
> > >>>             zoieHome.shutdown();
> > >>>         }
> > >>>     }
> >
> > >>>     private void updateReader(boolean waitForSearcher) throws
> > >>> IOException {
> > >>>         callPostCommitCallbacks();
> > >>>         Future[] waitSearcher =3D null;
> > >>>         if (waitForSearcher) {
> > >>>             waitSearcher =3D new Future[1];
> > >>>         }
> > >>>         core.getSearcher(true, false, waitSearcher);
> > >>>     }
> >
> > >>>     @Override
> > >>>     public void commit(CommitUpdateCommand cmd) throws IOException =
{
> > >>>         if (zoie !=3D null) {
> > >>>             try {
> > >>>                 zoie.flushEvents(10000);
> > >>>             } catch (ZoieException e) {
> > >>>                 log.error(e.getMessage(), e);
> > >>>             }
> > >>>         }
> > >>>         updateReader(cmd.waitSearcher);
> > >>>     }
> >
> > >>>     @Override
> > >>>     public void delete(DeleteUpdateCommand cmd) throws IOException =
{
> > >>>         String id =3D cmd.id;
> > >>>         long zoieUid;
> > >>>         try {
> > >>>             zoieUid =3D Long.parseLong(id);
> > >>>         } catch (Exception e) {
> > >>>             throw new IOException("index uid must exist and of type
> > >>> long: " + id);
> > >>>         }
> > >>>         if (zoie =3D=3D null) {
> > >>>             throw new IOException("zoie is not setup");
> > >>>         }
> > >>>         // String version =3D zoie.getVersion();
> > >>>         long time =3D System.currentTimeMillis();
> > >>>         String version =3D String.valueOf(time);
> > >>>         DataEvent<DocumentWithID> event =3D new
> > >>> DataEvent<DocumentWithID>(new DocumentWithID(zoieUid, true),
> version);
> > >>>         try {
> > >>>             zoie.consume(Arrays.asList(event));
> > >>>         } catch (ZoieException e) {
> > >>>             log.error(e.getMessage(), e);
> >
> > ...
> >
> > read more >>
>
> --
> You received this message because you are subscribed to the Google Groups
> "zoie" group.
> To post to this group, send email to zoie@googlegroups.com.
> To unsubscribe from this group, send email to
> zoie+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/zoie?hl=3Den.
>
>

--0016e6dd990d6d8b2904b5c9f19f
Content-Type: text/html; charset=GB2312
Content-Transfer-Encoding: quoted-printable

You are right! Thank you.<div><br></div><div><a href=3D"https://github.com/=
javasoze/zoie/blob/master/zoie-solr/src/main/java/proj/zoie/solr/ZoieUpdate=
Handler.java">https://github.com/javasoze/zoie/blob/master/zoie-solr/src/ma=
in/java/proj/zoie/solr/ZoieUpdateHandler.java</a></div>
<div><br></div><div>Will do a snapshot deploy today.</div><div><br></div><d=
iv>Master is upgraded with lucene 3.5.0 btw.</div><div><br></div><div>-John=
<br><br><div class=3D"gmail_quote">2012/1/4 genuine <span dir=3D"ltr">&lt;<=
a href=3D"mailto:yzygenu...@gmail.com">yzygenu...@gmail.com</a>&gt;</span><=
br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">I saw the soure,but it has not change :<br>
<div class=3D"im">// long uid =3D zoieReader.getUID(doc + base);<br>
 &nbsp; long uid =3D zoieReader.getUID(doc);<br>
<br>
</div>The zoieReader is refer the ZoieSegmentReader, not ZoieMultiReader,so=
<br>
doc doesn&#39;t need to add base.<br>
<div class=3D"im"><br>
On Dec 30 2011, 12:30 am, John Wang &lt;<a href=3D"mailto:john.w...@gmail.c=
om">john.w...@gmail.com</a>&gt; wrote:<br>
&gt; Oh. I think yo uare using a very old jar.<br>
&gt;<br>
&gt; See source at:<br>
&gt;<br>
</div>&gt; <a href=3D"https://github.com/javasoze/zoie/blob/master/zoie-sol=
r/src/main/java/." target=3D"_blank">https://github.com/javasoze/zoie/blob/=
master/zoie-solr/src/main/java/.</a>..<br>
<div class=3D"im">&gt;<br>
&gt; So your change is definitely correct :)<br>
&gt;<br>
&gt; We will do a release shortly, stay tuned :)<br>
&gt;<br>
&gt; -John<br>
&gt;<br>
</div>&gt; 2011/12/27 Gino Yu &lt;<a href=3D"mailto:yzygenu...@gmail.com">y=
zygenu...@gmail.com</a>&gt;<br>
<div class=3D"im">&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &gt; That&#39;s I change the source..<br>
&gt;<br>
&gt; &gt; &nbsp; // long uid =3D zoieReader.getUID(doc + base);<br>
&gt; &gt; &nbsp; &nbsp;long uid =3D zoieReader.getUID(doc);<br>
&gt; &gt; I change it at deleteByQuery.And it work,but I can&#39;t sure it =
..<br>
&gt;<br>
</div>&gt; &gt; =D4=DA 2011=C4=EA12=D4=C227=C8=D5 =CF=C2=CE=E711:34=A3=ACJo=
hn Wang &lt;<a href=3D"mailto:john.w...@gmail.com">john.w...@gmail.com</a>&=
gt;=D0=B4=B5=C0=A3=BA<br>
<div class=3D"im">&gt;<br>
&gt; &gt; Is there a question or comment related to this post?<br>
&gt;<br>
&gt; &gt;&gt; -John<br>
&gt;<br>
</div>&gt; &gt;&gt; 2011/12/27 Gino Yu &lt;<a href=3D"mailto:yzygenu...@gma=
il.com">yzygenu...@gmail.com</a>&gt;<br>
<div><div class=3D"h5">&gt;<br>
&gt; &gt;&gt;&gt; package proj.zoie.solr;<br>
&gt;<br>
&gt; &gt;&gt;&gt; import it.unimi.dsi.fastutil.longs.LongArrayList;<br>
&gt; &gt;&gt;&gt; import it.unimi.dsi.fastutil.longs.LongList;<br>
&gt;<br>
&gt; &gt;&gt;&gt; import java.io.IOException;<br>
&gt; &gt;&gt;&gt; import java.net.URL;<br>
&gt; &gt;&gt;&gt; import java.util.ArrayList;<br>
&gt; &gt;&gt;&gt; import java.util.Arrays;<br>
&gt; &gt;&gt;&gt; import java.util.List;<br>
&gt; &gt;&gt;&gt; import java.util.concurrent.Future;<br>
&gt;<br>
&gt; &gt;&gt;&gt; import org.apache.log4j.Logger;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.document.Document;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.index.IndexReader;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.index.MultiReader;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.search.Collector;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.search.IndexSearcher;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.search.Query;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.search.Scorer;<br>
&gt; &gt;&gt;&gt; import org.apache.lucene.store.Directory;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.common.SolrException;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.common.util.NamedList;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.common.util.SimpleOrderedMap;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.core.SolrConfig;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.core.SolrCore;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.search.QueryParsing;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.AddUpdateCommand;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.CommitUpdateCommand;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.DeleteUpdateCommand;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.MergeIndexesCommand;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.RollbackUpdateCommand;<br>
&gt; &gt;&gt;&gt; import org.apache.solr.update.UpdateHandler;<br>
&gt;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.DataConsumer.DataEvent;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.DocIDMapper;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.Zoie;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.ZoieException;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.ZoieIndexReader;<br>
&gt; &gt;&gt;&gt; import proj.zoie.api.indexing.IndexingEventListener;<br>
&gt; &gt;&gt;&gt; import proj.zoie.impl.indexing.ZoieSystem;<br>
&gt;<br>
&gt; &gt;&gt;&gt; public class ZoieUpdateHandler extends UpdateHandler {<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private static Logger log =3D<br>
&gt; &gt;&gt;&gt; Logger.getLogger(ZoieUpdateHandler.class);<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private SolrCore _core;<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; /**<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* =BC=E4=B8=F4=B6=E0=B3=A4=CA=B1=BC=
=E4=D6=D8=D0=C2=B4=F2=BF=AAsearcher,=C4=AC=C8=CF=D6=B5=CA=C7=D2=BB=B7=D6=D6=
=D3<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;*/<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private static long intervalTime =3D 1000 *=
 60;// =D2=BB=B7=D6=D6=D3<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private Directory indexDir;<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private Zoie&lt;IndexReader, DocumentWithID=
&gt; zoie;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; /**<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* =BC=C7=C2=BC=D7=EE=BA=F3=D2=BB=B8=
=F6=B0=E6=B1=BE<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;*/<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private String lastVersion;<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; public ZoieUpdateHandler(SolrCore core) {<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; super(core);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; _core =3D core;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; SolrConfig solrConfig =3D _co=
re.getSolrConfig();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; indexDir =3D<br=
>
&gt; &gt;&gt;&gt; _core.getDirectoryFactory().open(solrConfig.getDataDir())=
;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(&quot=
;&quot;, e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; long interval =3D<br>
&gt; &gt;&gt;&gt; solrConfig.getInt(&quot;solrIndexSearcher.reopen.batchDel=
ay&quot;, (int)<br>
&gt; &gt;&gt;&gt; intervalTime);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; intervalTime =3D interval;<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;intervalTime=A3=BA&quot; + intervalTime=
 + &quot;<br>
&gt; &gt;&gt;&gt; ,=BC=E4=B8=F4=CA=B1=BC=E4=D6=D8=D0=C2=B4=F2=BF=AASolrInde=
xSearcher&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; ZoieSystemHome zoieHome =3D Z=
oieSystemHome.getInstance(_core);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoieHome =3D=3D null) {<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(&quot=
;zoie home is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Runti=
meException(&quot;zoie is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; zoie =3D zoieHome.getZoieSyst=
em();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoie =3D=3D null) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(&quot=
;zoie is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new Runti=
meException(&quot;zoie is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; lastVersion =3D zoie.getCurre=
ntReaderVersion();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;#######################################=
####################################&quot;<br>
&gt; &gt;&gt;&gt; + lastVersion);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; runOpenSolrIndexSearcher();<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;=B3=F5=CA=BC=BB=AF=BD=E1=CA=F8&quot;);<=
br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; ZoieSystem _zoie =3D (ZoieSys=
tem) zoie;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; _zoie.addIndexingEventListene=
r(new IndexingEventListener() {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void han=
dleIndexingEvent(IndexingEvent evt) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <=
a href=3D"http://log.info" target=3D"_blank">log.info</a>(&quot; ##########=
#=CB=A2=CA=FD=BE=DD=B5=BD=D3=B2=C5=CC=B5=C4=CA=C2=BC=FE ###########&quot;);=
<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void han=
dleUpdatedDiskVersion(String version) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <=
a href=3D"http://log.info" target=3D"_blank">log.info</a>(&quot;indexingEve=
ntListener update<br>
&gt; &gt;&gt;&gt; version###########&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; });<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; /**<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* =BC=E0=BF=D8=CA=C7=B7=F1=D6=D8=D0=
=C2=B4=F2=BF=AAsearcher<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;*/<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private void runOpenSolrIndexSearcher() {<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;=D7=BC=B1=B8=C6=F4=B6=AF=BC=E0=BF=D8=D6=
=D8=D0=C2=B4=F2=BF=AAsolrIndexSearcher=B5=C4=CF=DF=B3=CC=A1=A3=A1=A3&quot;)=
;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; Thread thread =3D new Thread(=
) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void run=
() {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t=
ry {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; <a href=3D"http://log.info" target=3D"_blank">log.info</a>(&qu=
ot;=D0=DD=CF=A210=C3=EB=A1=A3=A1=A3&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; Thread.sleep(10000);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }=
 catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; log.error(&quot;&quot;, e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }=
<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t=
ry {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; while (true) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" target=3D"_blank">lo=
g.info</a>(&quot;=D0=DD=CF=A2&quot; + intervalTime + &quot; &nbsp;=BA=C1=C3=
=EB=A1=A3=A1=A3&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; Thread.sleep(intervalTime);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; boolean hasChange =3D readerHasChange();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" target=3D"_blank">lo=
g.info</a>(&quot;reader=CA=C7=B7=F1=D3=D0=D0=DE=B8=C4=B9=FD################=
############:&quot;<br>
&gt; &gt;&gt;&gt; + hasChange);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; if (hasChange) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" target=
=3D"_blank">log.info</a>(&quot;=D6=D8=D0=C2=B4=F2=BF=AAsolrIndexSearcher&qu=
ot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateReader(false);=
<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(&quot;&quo=
t;, e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" target=3D"_blank">lo=
g.info</a>(&quot;=D0=DD=CF=A2&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }=
 catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; log.error(&quot;&quot;, e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }=
<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; };<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; thread.start();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;=C6=F4=B6=AF=BC=E0=CC=FD=CF=DF=B3=CC&qu=
ot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; /**<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* =BC=EC=B2=E2reader=CA=C7=B7=F1=D3=
=D0=D0=DE=B8=C4=A3=AC=C8=E7=B9=FB=D3=D0=D0=DE=B8=C4=D6=D8=D0=C2new searcher=
<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;*<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* @return<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;* @throws Exception<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp;*/<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private boolean readerHasChange() throws Ex=
ception {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; String version =3D zoie.getCu=
rrentReaderVersion();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href=3D"http://log.info" t=
arget=3D"_blank">log.info</a>(&quot;#######################################=
####version:&quot;<br>
&gt; &gt;&gt;&gt; + version);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (version =3D=3D null) {<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if ((version !=3D null &amp;&=
amp; lastVersion =3D=3D null) ||<br>
&gt; &gt;&gt;&gt; version.compareTo(lastVersion) &gt; 0) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastVersion =3D=
 version;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; public int addDoc(AddUpdateCommand cmd) thr=
ows IOException {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoie =3D=3D null) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IOExc=
eption(&quot;zoie is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; // String id =3D cmd.getIndex=
edId(_core.getSchema());<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; String uid2 =3D (String)<br>
&gt; &gt;&gt;&gt; cmd.solrDoc.getFieldValue(idField.getName());<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; long zoieUid;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoieUid =3D Lon=
g.parseLong(uid2);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IOExc=
eption(&quot;index uid must exist and of type<br>
&gt; &gt;&gt;&gt; long: &quot; + uid2);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; Document doc =3D cmd.doc;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; long time =3D System.currentT=
imeMillis();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; String version =3D String.val=
ueOf(time);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; DataEvent&lt;DocumentWithID&g=
t; event =3D new<br>
&gt; &gt;&gt;&gt; DataEvent&lt;DocumentWithID&gt;(new DocumentWithID(zoieUi=
d, doc), version);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoie.consume(Ar=
rays.asList(event));<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } catch (ZoieException e) {<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(&quot=
;&quot;, e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IOExc=
eption(e.toString());<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; public void close() throws IOException {<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; ZoieSystemHome zoieHome =3D Z=
oieSystemHome.getInstance(_core);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoieHome !=3D null) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoieHome.shutdo=
wn();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; private void updateReader(boolean waitForSe=
archer) throws<br>
&gt; &gt;&gt;&gt; IOException {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; callPostCommitCallbacks();<br=
>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; Future[] waitSearcher =3D nul=
l;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (waitForSearcher) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitSearcher =
=3D new Future[1];<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; core.getSearcher(true, false,=
 waitSearcher);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; public void commit(CommitUpdateCommand cmd)=
 throws IOException {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoie !=3D null) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z=
oie.flushEvents(10000);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (ZoieEx=
ception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l=
og.error(e.getMessage(), e);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; updateReader(cmd.waitSearcher=
);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; }<br>
&gt;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; @Override<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; public void delete(DeleteUpdateCommand cmd)=
 throws IOException {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; String id =3D <a href=3D"http=
://cmd.id" target=3D"_blank">cmd.id</a>;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; long zoieUid;<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoieUid =3D Lon=
g.parseLong(id);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IOExc=
eption(&quot;index uid must exist and of type<br>
&gt; &gt;&gt;&gt; long: &quot; + id);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (zoie =3D=3D null) {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new IOExc=
eption(&quot;zoie is not setup&quot;);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; // String version =3D zoie.ge=
tVersion();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; long time =3D System.currentT=
imeMillis();<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; String version =3D String.val=
ueOf(time);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; DataEvent&lt;DocumentWithID&g=
t; event =3D new<br>
&gt; &gt;&gt;&gt; DataEvent&lt;DocumentWithID&gt;(new DocumentWithID(zoieUi=
d, true), version);<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; try {<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zoie.consume(Ar=
rays.asList(event));<br>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; } catch (ZoieException e) {<b=
r>
&gt; &gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.error(e.get=
Message(), e);<br>
&gt;<br>
</div></div>&gt; ...<br>
&gt;<br>
&gt; read more &gt;&gt;<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;zoie&quot; group.<br>
To post to this group, send email to <a href=3D"mailto:z...@googlegroups.co=
m">zoie@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:zoie%2Bunsu=
bscribe@googlegroups.com">zoie+unsubscribe@googlegroups.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/zoie?hl=3Den" target=3D"_blank">http://groups.google.com/group/zoie?hl=
=3Den</a>.<br>
<br>
</div></div></blockquote></div><br></div>

--0016e6dd990d6d8b2904b5c9f19f--