Package org.apache.lucene.store

Examples of org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor


  }

  private void initSourceReader() {
    if (sourceLocation != null) {
      try {
        FSDirectory luceneIndexDir = FSDirectory.getDirectory(sourceLocation);
        this.reader = IndexReader.open(luceneIndexDir);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
View Full Code Here


        if (!indexFile.exists()) {
            return new StoreFilesMetaData(false, shardId, ImmutableMap.<String, StoreFileMetaData>of());
        }
        Map<String, StoreFileMetaData> files = Maps.newHashMap();
        // read the checksums file
        FSDirectory directory = FSDirectory.open(indexFile);
        Map<String, String> checksums = null;
        try {
            checksums = AbstractStore.readChecksums(directory);
            for (File file : indexFile.listFiles()) {
                // BACKWARD CKS SUPPORT
                if (file.getName().endsWith(".cks")) {
                    continue;
                }
                if (file.getName().startsWith("_checksums")) {
                    continue;
                }
                files.put(file.getName(), new StoreFileMetaData(file.getName(), file.length(), file.lastModified(), checksums.get(file.getName())));
            }
        } finally {
            directory.close();
        }

        // BACKWARD CKS SUPPORT
        for (File file : indexFile.listFiles()) {
            if (file.getName().endsWith(".cks")) {
View Full Code Here

    public IndexReader getReader() {
        if (state == State.closed) {
            throw new IllegalStateException("Can't get reader: the index is closed.");
        }
        try {
          FSDirectory dir = FSDirectory.getDirectory(path);
          dir.setDisableLocks(true);
            return IndexReader.open(dir);
        } catch (IOException e) {
            logger.error("Error while getting the reader.", e);
            throw new RuntimeException("Error while getting the reader.");
        }
View Full Code Here

        String field = args[0];
        String origIndex = args[1];
        String spellIndex = args[2];

        DidYouMeanIndexer indexer = new DidYouMeanIndexer();
        FSDirectory origDir = FSDirectory.getDirectory(origIndex);
        FSDirectory spellDir = FSDirectory.getDirectory(spellIndex);

        // Call intern() on field to work around bug in LuceneDictionary
        // WTF?
        indexer.createSpellIndex(field.intern(), origDir, spellDir);   
    }
View Full Code Here

        indexer.index(addC);
        indexer.index(addB);
        indexer.index(addA);
        Execute.sleep(8000);

        FSDirectory origDir = FSDirectory.getDirectory(tmpDir + File.separator + "indexer" + File.separator + "indexes" + File.separator + "index");
        FSDirectory spellDir = FSDirectory.getDirectory(tmpDir + File.separator + "spell");
        new DidYouMeanIndexer().createSpellIndex("content".intern(), origDir, spellDir);
        WordQuerySuggestor suggestor = new WordQuerySuggestor(spellDir.getFile());

        assertNotNull(suggestor.suggest(new LazyParsedQuery("content")));
        assertNotNull(suggestor.suggest(new LazyParsedQuery("contenta")));
        assertNotNull(suggestor.suggest(new LazyParsedQuery("contetb")));

        Config searcherConfig = Config.getConfig("searcher.properties");
        searcherConfig.set("compositeSearcher.useSpellCheckSuggestQuery", "true");
        searcherConfig.set("searcher.suggestQuerySearcher.dictionaryDir", spellDir.getFile().getAbsolutePath());
        searcher = new CompositeSearcher();

        GroupedSearchResults res = searcher.search(new LazyParsedQuery("contentb"), 0, 10, null, 20, null, null);
        assertEquals(1, res.totalGroupsEstimation());
        res = searcher.search(new LazyParsedQuery("content"), 0, 10, null, 20, null, null);
View Full Code Here

          throw e;
        }
      }
    }
   
    FSDirectory dir = null;
    switch(_mode)
    {
    case SIMPLE:
      dir = new SimpleFSDirectory(_location);
      break;
View Full Code Here

  {
    return _currentDirMgr;
  }
  private FSDirectory getFSDirectoryFromFile(File f) throws IOException
  {
    FSDirectory dir = null;
    switch(_mode)
    {
    case SIMPLE:
      dir = new SimpleFSDirectory(f);
      break;
View Full Code Here

*/
public class LuceneUidScanBenchmark {

    public static void main(String[] args) throws Exception {

        FSDirectory dir = FSDirectory.open(new File("work/test"));
        IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Lucene.VERSION, Lucene.STANDARD_ANALYZER));

        final int NUMBER_OF_THREADS = 2;
        final long INDEX_COUNT = SizeValue.parseSizeValue("1m").singles();
        final long SCAN_COUNT = SizeValue.parseSizeValue("100k").singles();
View Full Code Here

     * @return                  The directory value
     * @exception  IOException  Description of Exception
     * @since
     */
    public static Directory getDirectory(File directory, boolean create) throws IOException {
        FSDirectory fsDirectory = FSDirectory.getDirectory(directory, create);
        return fsDirectory;
    }
View Full Code Here

    BufferStore.initNewBuffer(1024, 1024 * 128);
    BufferStore.initNewBuffer(8192, 8192 * 128);
    file = new File(TMPDIR, "blockdirectorytest");
    rm(file);
    file.mkdirs();
    FSDirectory dir = FSDirectory.open(new File(file, "base"));
    mapperCache = new MapperCache();
    directory = new BlockDirectory("test", dir, mapperCache);
    seed = new Random().nextLong();
    System.out.println("Seed is " + seed);
    random = new Random(seed);
View Full Code Here

TOP

Related Classes of org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor

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.