Package proj.zoie.api

Examples of proj.zoie.api.ZoieException


      return result;
  }
  catch(Exception e)
  {
    log.error(e.getMessage(),e);
    throw new ZoieException(e.getMessage(),e);
  }
  finally
  {
    try{
      if (searcher!=null){
View Full Code Here


          if (measureIndexSize)
            _indexSizeMeter.mark(indexSize);
        }
      }
      catch(Exception e){
        throw new ZoieException(e.getMessage(),e);
      }
    }
View Full Code Here

      result.setHits(hitList.toArray(new SearchHit[hitList.size()]));
      return result;
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new ZoieException(e.getMessage(), e);
    } finally {
      if (multiReader != null) {
        try {
          multiReader.close();
        } catch (IOException e) {
View Full Code Here

  public void flushEvents() throws ZoieException {
    try {
      _store.commit();
    } catch (Exception e) {
      throw new ZoieException(e.getMessage(), e);
    }
  }
View Full Code Here

      }
      idxSystem.returnIndexReaders(readers);

      assertEquals(count, numDocs);
    } catch (IOException ioe) {
      throw new ZoieException(ioe.getMessage());
    } finally {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
View Full Code Here

      ret = searcher.search(q, 100);

      TestCase.assertEquals(0, ret.totalHits);
      zoie.returnIndexReaders((List) readerList);
    } catch (IOException ioe) {
      throw new ZoieException(ioe.getMessage());
    } finally {
      zoie.shutdown();
      deleteDirectory(idxDir);
    }
  }
View Full Code Here

      TestCase.assertTrue("numdDocs should be 5, but it is " + numDocs, numDocs == 5);

      idxSystem.returnIndexReaders(readers);

    } catch (IOException ioe) {
      throw new ZoieException(ioe.getMessage());
    } finally {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
View Full Code Here

      }
      TestCase.assertNull(data);
      idxSystem.returnIndexReaders(readers);

    } catch (IOException ioe) {
      throw new ZoieException(ioe.getMessage());
    } finally {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
View Full Code Here

    QueryParser parser = new QueryParser(Version.LUCENE_43, "contents", idxSystem.getAnalyzer());
    Query q = null;
    try {
      q = parser.parse(query);
    } catch (Exception e) {
      throw new ZoieException(e.getMessage(), e);
    }
    MemoryStreamDataProvider<String> memoryProvider = new MemoryStreamDataProvider<String>(
        ZoieConfig.DEFAULT_VERSION_COMPARATOR);
    memoryProvider.setMaxEventsPerMinute(Long.MAX_VALUE);
    memoryProvider.setDataConsumer(idxSystem);
    memoryProvider.start();
    try {
      int count = DataForTests.testdata.length;
      List<DataEvent<String>> list = new ArrayList<DataEvent<String>>(count);

      for (int i = 0; i < count; ++i) {
        list.add(new DataEvent<String>(DataForTests.testdata[i], "" + i));
      }
      memoryProvider.addEvents(list);

      idxSystem.syncWithVersion(10000, "" + (count - 1));

      int repeat = 20;
      int idx = 0;
      int[] results = new int[repeat];
      int[] expected = new int[repeat];
      Arrays.fill(expected, count);

      // should be consumed by the idxing system
      IndexSearcher searcher = null;
      MultiReader reader = null;
      List<ZoieMultiReader<IndexReader>> readers = null;
      for (int i = 0; i < repeat; ++i) {
        try {
          readers = idxSystem.getIndexReaders();
          reader = new MultiReader(readers.toArray(new IndexReader[readers.size()]), false);
          searcher = new IndexSearcher(reader);

          TopDocs hits = searcher.search(q, 10);
          results[idx++] = hits.totalHits;

        } finally {
          try {
            if (searcher != null) {
              searcher = null;
              reader.close();
              reader = null;
            }
          } finally {
            idxSystem.returnIndexReaders(readers);
          }
        }
        try {
          Thread.sleep(30);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }

      assertEquals("maybe race condition in disk flush", Arrays.toString(expected),
        Arrays.toString(results));
    } catch (IOException ioe) {
      throw new ZoieException(ioe.getMessage());
    } finally {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
View Full Code Here

        queryThread.join();
        assertTrue("count mismatch[" + queryThread.message + "]", !queryThread.mismatch);
      }
    } catch (Exception e) {
      for (QueryThread queryThread : queryThreads) {
        if (queryThread.exception == null) throw new ZoieException(e);
      }
    } finally {
      memoryProvider.stop();
      idxSystem.shutdown();
      deleteDirectory(idxDir);
    }
    System.out.println(" done round");
    log.info(" done round");
    for (QueryThread queryThread : queryThreads) {
      if (queryThread.exception != null) throw new ZoieException(queryThread.exception);
    }
  }
View Full Code Here

TOP

Related Classes of proj.zoie.api.ZoieException

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.