Examples of IndexWriterConfig


Examples of com.dotcms.repackage.org.apache.lucene.index.IndexWriterConfig

        IndexWriter writer = null;

                try {

                    Directory directory = FSDirectory.open( new File( luceneDir ) );
                    IndexWriterConfig config = new IndexWriterConfig( Version.LUCENE_CURRENT, new WhitespaceAnalyzer( Version.LUCENE_CURRENT ) );
                    /*
                    IndexWriterConfig.OpenMode.CREATE_OR_APPEND if used IndexWriter will create a new index if there is not
                    already an index at the provided path and otherwise open the existing index.
                     */
                    config.setOpenMode( IndexWriterConfig.OpenMode.CREATE_OR_APPEND );

                    writer = new IndexWriter( directory, config );
                } catch ( IOException e ) {
                    Logger.error( this, e.getMessage(), e );
                }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

      objects = new ArrayList();

      analyzer = new SimpleAnalyzer();
      indexDirectory = new RAMDirectory();
      indexWriter = new IndexWriter(indexDirectory,
          new IndexWriterConfig(Version.LUCENE_31,
              new LimitTokenCountAnalyzer(analyzer,
                  Integer.MAX_VALUE))
              .setOpenMode(OpenMode.CREATE));
      queryParser = new QueryParser(Version.LUCENE_31, "text", analyzer);
      queryParser.setDefaultOperator(QueryParser.AND_OPERATOR);
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

      System.out.println("TEST: setUp");
    }
    // prepare a small index with just a few documents. 
    dir = newDirectory();
    anlzr = new MockAnalyzer(random);
    IndexWriterConfig iwc = newIndexWriterConfig( TEST_VERSION_CURRENT, anlzr).setMergePolicy(newLogMergePolicy());
    RandomIndexWriter iw = new RandomIndexWriter(random, dir, iwc);
    if (doMultiSegment) {
      iw.w.setMaxBufferedDocs(_TestUtil.nextInt(random, 2, 7));
    }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

    doc.add( new Field( f, v, Store.YES, Index.ANALYZED ) );
    return doc;
  }
 
  private void makeIndex() throws IOException {
    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
    writer.addDocument( doc( "t_text1", "random words for highlighting tests del" ) );
    writer.addDocument( doc( "t_text1", "more random words for second field del" ) );
    writer.addDocument( doc( "t_text1", "random words for highlighting tests del" ) );
    writer.addDocument( doc( "t_text1", "more random words for second field" ) );
    writer.optimize();
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

    writer.optimize();
    writer.close();
  }
 
  private void deleteDocument() throws IOException {
    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)).setOpenMode(OpenMode.APPEND));
    writer.deleteDocuments( new Term( "t_text1", "del" ) );
    // To see negative idf, keep comment the following line
    //writer.optimize();
    writer.close();
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

  }

  @Test
  public void baseUIMAAnalyzerIntegrationTest() throws Exception {
    Directory dir = new RAMDirectory();
    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(Version.LUCENE_40, analyzer));
    // add the first doc
    Document doc = new Document();
    String dummyTitle = "this is a dummy title ";
    doc.add(new TextField("title", dummyTitle, Field.Store.YES));
    String dummyContent = "there is some content written here";
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

 
  public void testFarsiRangeFilterCollating(Analyzer analyzer, BytesRef firstBeg,
                                            BytesRef firstEnd, BytesRef secondBeg,
                                            BytesRef secondEnd) throws Exception {
    Directory dir = newDirectory();
    IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));
    Document doc = new Document();
    doc.add(new TextField("content", "\u0633\u0627\u0628", Field.Store.YES));
    doc.add(new StringField("body", "body", Field.Store.YES));
    writer.addDocument(doc);
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

  public void testFarsiRangeQueryCollating(Analyzer analyzer, BytesRef firstBeg,
                                            BytesRef firstEnd, BytesRef secondBeg,
                                            BytesRef secondEnd) throws Exception {
    Directory dir = newDirectory();
    IndexWriter writer = new IndexWriter(dir, 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

Examples of org.apache.lucene.index.IndexWriterConfig

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

    Directory farsiIndex = newDirectory();
    IndexWriter writer = new IndexWriter(farsiIndex, new IndexWriterConfig(
        TEST_VERSION_CURRENT, analyzer));
    Document doc = new Document();
    doc.add(new TextField("content", "\u0633\u0627\u0628", Field.Store.YES));
    doc.add(new StringField("body", "body", Field.Store.YES));
    writer.addDocument(doc);
View Full Code Here

Examples of org.apache.lucene.index.IndexWriterConfig

                                   String usResult,
                                   String frResult,
                                   String svResult,
                                   String dkResult) throws Exception {
    Directory indexStore = newDirectory();
    IndexWriter writer = new IndexWriter(indexStore, new IndexWriterConfig(
        TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false)));

    // document data:
    // the tracer field is used to determine which document was hit
    String[][] sortData = new String[][] {
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.