Package org.apache.lucene.store

Examples of org.apache.lucene.store.Directory.fileLength()


    int blockSize = 8192;
    // int blockSize = 1024 * 1024;
    long totalLookups = 0;
    for (String s : directory.listAll()) {
      if (s.endsWith(".pos") || s.endsWith(".doc") || s.endsWith(".tim")) {
        long fileLength = directory.fileLength(s);
        long maxHits = (long) Math.ceil(fileLength / (double) blockSize);
        totalLookups += maxHits;
        System.out.println("file [" + s + "] size [" + fileLength + "] maxhits [" + maxHits + "]");
      }
    }
View Full Code Here


  private void getFilePositionsToWarm(IndexReader reader, String segmentName, String fileName, String fieldName,
      long startingPosition, long endingPosition, String context, Map<String, OpenBitSet> filePartsToWarm, int blockSize)
      throws IOException {
    Directory dir = getDirectory(reader, segmentName, context);
    long fileLength = dir.fileLength(fileName);
    if (endingPosition == Long.MAX_VALUE) {
      endingPosition = fileLength - 1;
    }
    OpenBitSet openBitSet = filePartsToWarm.get(fileName);
    if (openBitSet == null) {
View Full Code Here

    if (dir == null) {
      LOG.info("Context [{0}] cannot find segment [{1}]", context, segmentName);
      return;
    }
    if (endingPosition == Long.MAX_VALUE) {
      endingPosition = dir.fileLength(fileName) - 1;
    }
    if (_isClosed.get() || _stop.get()) {
      LOG.info("Context [{0}] index closed", context);
      return;
    }
View Full Code Here

  @Test
  public void testEOF() throws IOException {
    Directory fsDir = new RAMDirectory();
    String name = "test.eof";
    createFile(name, fsDir, directory);
    long fsLength = fsDir.fileLength(name);
    long hdfsLength = directory.fileLength(name);
    assertEquals(fsLength, hdfsLength);
    testEof(name, fsDir, fsLength);
    testEof(name, directory, hdfsLength);
  }
View Full Code Here

    assertTrue(output != null);
    //Use a RAMOutputStream
   
      fieldInfos.write(output);
      output.close();
      assertTrue(dir.fileLength(name) > 0);
      FieldInfos readIn = new FieldInfos(dir, name);
      assertTrue(fieldInfos.size() == readIn.size());
      FieldInfo info = readIn.fieldInfo("textField1");
      assertTrue(info != null);
      assertTrue(info.storeTermVector == false);
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

    System.out.print(end.getTime() - start.getTime());
    System.out.println(" milliseconds to write table");

    System.out.println(" table occupies " +
           store.fileLength("words.tis") + " bytes");

    start = new Date();

    TermInfosReader reader = new TermInfosReader(store, "words", fis);
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

      try {
        Directory dir = (Directory) index;
        int size = 0;
        String[] fileNames = dir.list();
        for (int i=0; i < fileNames.length; i++) {
          size += dir.fileLength(fileNames[i]);
        }
        return size;
      }
      catch (IOException e) { // can never happen (RAMDirectory)
        throw new RuntimeException(e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.