Package proj.zoie.api

Examples of proj.zoie.api.DataDoc


    Document d3 = new Document();
    StringField f3 = new StringField("num", "abcde", Store.YES);
    d3.add(f3);

    DataEvent<DataDoc> de1 = new DataEvent<DataDoc>(new DataDoc(1, d1), "1");
    DataEvent<DataDoc> de2 = new DataEvent<DataDoc>(new DataDoc(2, d2), "1");
    DataEvent<DataDoc> de3 = new DataEvent<DataDoc>(new DataDoc(3, d3), "1");

    try {
      zoie.consume(Arrays.asList(de1, de2, de3));
      zoie.flushEvents(10000);

      List<?> readerList = zoie.getIndexReaders();
      // combine the readers
      MultiReader reader = new MultiReader(readerList.toArray(new IndexReader[readerList.size()]),
          false);
      // do search
      IndexSearcher searcher = new IndexSearcher(reader);
      QueryParser parser = new QueryParser(Version.LUCENE_43, "num", new StandardAnalyzer(
          Version.LUCENE_43));
      Query q = parser.parse("num:abc*");
      TopDocs ret = searcher.search(q, 100);
      TestCase.assertEquals(3, ret.totalHits);

      zoie.returnIndexReaders((List) readerList);

      de1 = new DataEvent<DataDoc>(new DataDoc(1), "2");
      de2 = new DataEvent<DataDoc>(new DataDoc(2), "2");
      de3 = new DataEvent<DataDoc>(new DataDoc(3), "2");
      zoie.consume(Arrays.asList(de1, de2, de3));

      zoie.flushEventsToMemoryIndex(10000);

      readerList = zoie.getIndexReaders();
View Full Code Here

TOP

Related Classes of proj.zoie.api.DataDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.