Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexWriterConfig


                TextField.TYPE_NOT_STORED));
        doc.add(new Field("subject", "weapons",
                TextField.TYPE_NOT_STORED));

        /* setting up a writer with a default (simple) analyzer */
        writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(),
                new SimpleAnalyzer(SKOSAnalysisPlugin.getLuceneVersion())));

        /* adding the document to the index */
        writer.addDocument(doc);

View Full Code Here


        analyzerPerField.put("subject", skosAnalyzer);
        PerFieldAnalyzerWrapper indexAnalyzer = new PerFieldAnalyzerWrapper(
                new SimpleAnalyzer(SKOSAnalysisPlugin.getLuceneVersion()), analyzerPerField);

        /* setting up a writer with a default (simple) analyzer */
        writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(),
                indexAnalyzer));

        /* adding the document to the index */
        writer.addDocument(doc);

View Full Code Here

        analyzerPerField.put("subject", skosAnalyzer);
        PerFieldAnalyzerWrapper indexAnalyzer = new PerFieldAnalyzerWrapper(
                new SimpleAnalyzer(SKOSAnalysisPlugin.getLuceneVersion()), analyzerPerField);

        /* setting up a writer with a default (simple) analyzer */
        writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(),
                indexAnalyzer));

        /* adding the document to the index */
        writer.addDocument(doc);

View Full Code Here

    @BeforeMethod
    @Override
    public void setUp() throws Exception {
        super.setUp();
        skosAnalyzer = new SKOSAnalyzer(skosEngine, ExpansionType.URI);
        writer = new IndexWriter(directory, new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(),
                skosAnalyzer));
    }
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();
        skosAnalyzer = new SKOSAnalyzer(skosEngine,
                SKOSAnalyzer.ExpansionType.LABEL);
        writer = new IndexWriter(directory, new IndexWriterConfig(SKOSAnalysisPlugin.getLuceneVersion(),
                skosAnalyzer));
    }
View Full Code Here

    }

    static void writeTestIndex(Directory dir) throws IOException {

        IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, new KeywordAnalyzer());
        iwc.setCodec(new MockCodec());

        IndexWriter writer = new IndexWriter(dir, iwc);

        FieldType ft = new FieldType();
        ft.setIndexed(true);
View Full Code Here

      }
    }
    closeTaxonomyWriter();
   
    // Workaround for missing delete all method in the TaxonomyWriter
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_30,
              new KeywordAnalyzer()).setOpenMode(this.writerOpenMode).setMergePolicy(
              new LogByteSizeMergePolicy());    
    try {     
      IndexWriter indexWriter = new IndexWriter(directory, config);
      indexWriter.deleteAll();
View Full Code Here

  public IndexReader getReader() throws CorruptIndexException, IOException {
    return IndexReader.open(index);
  }

  public void add(Document document) throws CorruptIndexException, IOException {
    IndexWriterConfig indexWriterConfig = new IndexWriterConfig(LuceneVersion.getVersion(), ANALYZER);
    IndexWriter writer = new IndexWriter(index, indexWriterConfig);
    writer.addDocument(document);
    writer.optimize();
    writer.close();
  }
View Full Code Here

    _open.set(true);

    if (!DirectoryReader.indexExists(directory)) {
      LOG.info("Creating an empty index");
      // if the directory is empty then create an empty index.
      IndexWriterConfig conf = new IndexWriterConfig(LUCENE_VERSION, new KeywordAnalyzer());
      conf.setWriteLockTimeout(TimeUnit.MINUTES.toMillis(5));
      new BlurIndexWriter(directory, conf).close();
    }
    _indexReaderRef.set(DirectoryReader.open(directory));
    _refresher.register(this);
  }
View Full Code Here

        // FIXME: Hack needed to make Lucene work in an OSGi environment
        Thread thread = Thread.currentThread();
        ClassLoader loader = thread.getContextClassLoader();
        thread.setContextClassLoader(IndexWriterConfig.class.getClassLoader());
        try {
            IndexWriterConfig config = new IndexWriterConfig(VERSION, analyzer);
            config.setMergeScheduler(new SerialMergeScheduler());
            return config;
        } finally {
            thread.setContextClassLoader(loader);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.IndexWriterConfig

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.