Package org.apache.lucene.index

Examples of org.apache.lucene.index.DirectoryReader$MultiTermPositions


      Document[] data = createData();

      TestDataDigester testDigester = new TestDataDigester(_facetHandlers, data);
      BoboIndexer indexer = new BoboIndexer(testDigester, dir);
      indexer.index();
      DirectoryReader r = DirectoryReader.open(dir);
      r.close();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here


    BrowseResult result = null;
    BoboBrowser boboBrowser = null;
    int expectedHitNum = (_documentSize / 2) - 1;
    try {
      Directory ramIndexDir = createIndex();
      DirectoryReader srcReader = DirectoryReader.open(ramIndexDir);
      boboBrowser = new BoboBrowser(BoboMultiReader.getInstance(srcReader, _facetHandlers));
      result = boboBrowser.browse(br);

      assertEquals(expectedHitNum, result.getNumHits());
View Full Code Here

    BrowseResult result = null;
    BoboBrowser boboBrowser = null;

    try {
      Directory ramIndexDir = createIndexTwo();
      DirectoryReader srcReader = DirectoryReader.open(ramIndexDir);
      boboBrowser = new BoboBrowser(BoboMultiReader.getInstance(srcReader, _facetHandlers));

      BrowseRequest br = new BrowseRequest();
      br.setCount(20);
      br.setOffset(0);
View Full Code Here

    _fconf = buildFieldConf();
    _indexDir = createIndex();
  }

  private BoboMultiReader newIndexReader() throws IOException {
    DirectoryReader srcReader = DirectoryReader.open(_indexDir);
    try {
      BoboMultiReader reader = BoboMultiReader.getInstance(srcReader, _fconf);
      return reader;
    } catch (IOException ioe) {
      if (srcReader != null) {
        srcReader.close();
      }
      throw ioe;
    }
  }
View Full Code Here

      Document[] data = buildData();

      TestDataDigester testDigester = new TestDataDigester(_fconf, data);
      BoboIndexer indexer = new BoboIndexer(testDigester, idxDir);
      indexer.index();
      DirectoryReader r = DirectoryReader.open(idxDir);
      r.close();
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

    return null;
  }

  public void testLuceneSort() throws IOException {

    DirectoryReader srcReader = DirectoryReader.open(_indexDir);
    try {
      List<FacetHandler<?>> facetHandlers = new ArrayList<FacetHandler<?>>();
      facetHandlers.add(new SimpleFacetHandler("id"));

      BoboMultiReader reader = BoboMultiReader.getInstance(srcReader, facetHandlers);
      BoboBrowser browser = new BoboBrowser(reader);

      BrowseRequest browseRequest = new BrowseRequest();
      browseRequest.setCount(10);
      browseRequest.setOffset(0);
      browseRequest.addSortField(new SortField("date", SortField.Type.STRING));

      doTest(browser, browseRequest, 7, null, new String[] { "1", "3", "5", "2", "4", "7", "6" });

    } catch (IOException ioe) {
      if (srcReader != null) {
        srcReader.close();
      }
      throw ioe;
    }
  }
View Full Code Here

      idxWriter.addDocument(d);
      idxWriter.forceMerge(1);
      idxWriter.commit();
    }
    idxWriter.close();
    DirectoryReader idxReader = DirectoryReader.open(idxDir);
    BoboMultiReader boboReader = BoboMultiReader.getInstance(idxReader, facetHandlers);
    BoboBrowser browser = new BoboBrowser(boboReader);
    List<String> ranges = new ArrayList<String>();
    ranges.add("000000001");
    ranges.add("000010000");// one hour
View Full Code Here

   
    // We need to get an answer from the on-disk index.
    initReaderManager();

    int doc = -1;
    DirectoryReader reader = readerManager.acquire();
    try {
      final BytesRef catTerm = new BytesRef(categoryPath.toString(delimiter));
      TermsEnum termsEnum = null; // reuse
      DocsEnum docs = null; // reuse
      for (AtomicReaderContext ctx : reader.leaves()) {
        Terms terms = ctx.reader().terms(Consts.FULL);
        if (terms != null) {
          termsEnum = terms.iterator(termsEnum);
          if (termsEnum.seekExact(catTerm)) {
            // liveDocs=null because the taxonomy has no deletes
View Full Code Here

    shouldFillCache = false;
   
    initReaderManager();

    boolean aborted = false;
    DirectoryReader reader = readerManager.acquire();
    try {
      TermsEnum termsEnum = null;
      DocsEnum docsEnum = null;
      for (AtomicReaderContext ctx : reader.leaves()) {
        Terms terms = ctx.reader().terms(Consts.FULL);
        if (terms != null) { // cannot really happen, but be on the safe side
          termsEnum = terms.iterator(termsEnum);
          while (termsEnum.next() != null) {
            if (!cache.isFull()) {
View Full Code Here

  private TaxonomyIndexArrays getTaxoArrays() throws IOException {
    if (taxoArrays == null) {
      synchronized (this) {
        if (taxoArrays == null) {
          initReaderManager();
          DirectoryReader reader = readerManager.acquire();
          try {
            // according to Java Concurrency, this might perform better on some
            // JVMs, since the object initialization doesn't happen on the
            // volatile member.
            TaxonomyIndexArrays tmpArrays = new TaxonomyIndexArrays(reader);
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.DirectoryReader$MultiTermPositions

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.