Package org.apache.lucene.index

Examples of org.apache.lucene.index.IndexWriterConfig


  }

  private static Directory makeEmptyIndex(Random random, final int numDeletedDocs)
    throws IOException {
    Directory d = new MockDirectoryWrapper(random, new RAMDirectory());
      IndexWriter w = new IndexWriter(d, new IndexWriterConfig(
        TEST_VERSION_CURRENT, new MockAnalyzer(random)));

      for (int i = 0; i < numDeletedDocs; i++) {
        w.addDocument(new Document());
      }
View Full Code Here


   
  public void testFarsiRangeFilterCollating(Analyzer analyzer, String firstBeg,
                                            String firstEnd, String secondBeg,
                                            String secondEnd) throws Exception {
    RAMDirectory ramDir = new RAMDirectory();
    IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));
    Document doc = new Document();
    doc.add(new Field("content", "\u0633\u0627\u0628",
                      Field.Store.YES, Field.Index.ANALYZED));
    doc.add(new Field("body", "body",
View Full Code Here

  public void testFarsiRangeQueryCollating(Analyzer analyzer, String firstBeg,
                                            String firstEnd, String secondBeg,
                                            String secondEnd) throws Exception {
    RAMDirectory ramDir = new RAMDirectory();
    IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));
    Document doc = new Document();

    // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
    // orders the U+0698 character before the U+0633 character, so the single
View Full Code Here

  public void testFarsiTermRangeQuery(Analyzer analyzer, String firstBeg,
      String firstEnd, String secondBeg, String secondEnd) throws Exception {

    RAMDirectory farsiIndex = new RAMDirectory();
    IndexWriter writer = new IndexWriter(farsiIndex, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));
    Document doc = new Document();
    doc.add(new Field("content", "\u0633\u0627\u0628",
                      Field.Store.YES, Field.Index.ANALYZED));
    doc.add(new Field("body", "body",
View Full Code Here

      = new PerFieldAnalyzerWrapper(new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
    analyzer.addAnalyzer("US", usAnalyzer);
    analyzer.addAnalyzer("France", franceAnalyzer);
    analyzer.addAnalyzer("Sweden", swedenAnalyzer);
    analyzer.addAnalyzer("Denmark", denmarkAnalyzer);
    IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));

    // document data:
    // the tracer field is used to determine which document was hit
    String[][] sortData = new String[][] {
View Full Code Here

                + " This directory will not be indexed. Please check permissions and rebuild indexes.");
        }
    }

    private void openIndexWriter() throws IOException {
        IndexWriterConfig indexWriterConfig;
        // use create or append so we can reuse existing index if already exists
        indexWriterConfig = new IndexWriterConfig(Version.LUCENE_36, getAnalyzer()).setOpenMode(OpenMode.CREATE_OR_APPEND);
        indexWriter = new IndexWriter(niofsDirectory, indexWriterConfig);
    }
View Full Code Here

public class TestSnapshotDeletionPolicy extends LuceneTestCase {
  public static final String INDEX_PATH = "test.snapshots";
 
  protected IndexWriterConfig getConfig(Random random, IndexDeletionPolicy dp) {
    IndexWriterConfig conf = newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random));
    if (dp != null) {
      conf.setIndexDeletionPolicy(dp);
    }
    return conf;
  }
View Full Code Here

*/
public class TestUnoptimizedReaderOnConstructor extends LuceneTestCase {

  public void test() throws Exception {
    Directory dir = newDirectory();
    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
    addDocument(iw, "Hello, world!");
    addDocument(iw, "All work and no play makes jack a dull boy");
    iw.close();

    iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND));
    addDocument(iw, "Hello, tellus!");
    addDocument(iw, "All work and no play makes danny a dull boy");
    iw.close();

    iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.APPEND));
    addDocument(iw, "Hello, earth!");
    addDocument(iw, "All work and no play makes wendy a dull girl");
    iw.close();

    IndexReader unoptimizedReader = IndexReader.open(dir, false);
View Full Code Here

    // ==

    public static IndexWriterConfig defaultConfig()
    {
        final IndexWriterConfig config = new IndexWriterConfig( Version.LUCENE_36, new NexusAnalyzer() );
        // default open mode is CreateOrAppend which suits us
        config.setRAMBufferSizeMB( 2.0 ); // old default
        config.setMergeScheduler( new SerialMergeScheduler() ); // merging serially
        return config;
    }
View Full Code Here

      TableContext tableContext = TableContext.create(tableDescriptor);
      _fieldManager = tableContext.getFieldManager();
      Analyzer analyzer = _fieldManager.getAnalyzerForIndex();

      _conf = new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION, analyzer);
      TieredMergePolicy mergePolicy = (TieredMergePolicy) _conf.getMergePolicy();
      mergePolicy.setUseCompoundFile(false);

      _overFlowConf = new IndexWriterConfig(LuceneVersionConstant.LUCENE_VERSION, analyzer);
      _overFlowConf.setMergePolicy(NoMergePolicy.NO_COMPOUND_FILES);

      if (_indexLocally) {
        String localDirPath = System.getProperty(JAVA_IO_TMPDIR);
        _localPath = new File(localDirPath, UUID.randomUUID().toString() + ".tmp");
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.