Examples of WhitespaceAnalyzer


Examples of com.dotcms.repackage.org.apache.lucene.analysis.core.WhitespaceAnalyzer

        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 );
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

    }
   
  @Override
  protected void setUp() throws Exception {
      directory = new RAMDirectory();
      analyzer = new WhitespaceAnalyzer();
      IndexWriter writer = new IndexWriter(directory, analyzer, true, MaxFieldLength.UNLIMITED);
      Document doc = new Document();
      addMetaDataField(doc,PathHandlerName,new String[]{"/a/b/c","/a/b/d"});
      writer.addDocument(doc);
      writer.commit();
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

     * @param nestedAnalyzer The nested analyzer.
     * @param untokenizedFieldNames The names of the fields that should not be
     *        tokenized.
     */
    public WrapperAnalyzer(Analyzer nestedAnalyzer, String[] untokenizedFieldNames) {
      mNoStemmingAnalyzer = new WhitespaceAnalyzer();
      mNestedAnalyzer = nestedAnalyzer;

      mUntokenizedFieldNames = new HashSet();
      mUntokenizedFieldNames.addAll(Arrays.asList(untokenizedFieldNames));
    }
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

  }
 
  //@Override
  protected void setUp() throws Exception {
    directory = new RAMDirectory();
    analyzer = new WhitespaceAnalyzer();
    writer = new IndexWriter(directory, analyzer, true, MaxFieldLength.UNLIMITED);
    addDoc("1", new String[]{ "aa","bb"}, new String[]{"aaa","aaa"}, new int[]{100,200});
    addDoc("2", new String[]{ "aa","bb"}, new String[]{"aaa","bbb"}, new int[]{200,200});
    addDoc("3", new String[]{ "aa","bb"}, new String[]{"bbb","aaa"}, new int[]{300,300});
    addDoc("3", new String[]{ "bb","aa"}, new String[]{"bbb","bbb"}, new int[]{300,400});
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

            }
          }
        }
 
        // Check whether the document is in the index
        Analyzer analyzer = new WhitespaceAnalyzer();
        QueryParser parser = new QueryParser(Version.LUCENE_30, "url", analyzer);
        String queryString = "\"" + transformedFileUrl + "\"";
       
        try {
          query = parser.parse(queryString);
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

        isOptimized = r.isOptimized();
        r.close();
      }
      if (!isOptimized) {
        conf = newIndexWriterConfig(TEST_VERSION_CURRENT,
                                    new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(
                                                                                              OpenMode.APPEND).setIndexDeletionPolicy(policy);
        mp = conf.getMergePolicy();
        if (mp instanceof LogMergePolicy) {
          setUseCompoundFile(mp, true);
        }
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

  }
 
  public DocsAndWriter indexRandomIWReader(int nThreads, int iterations, int range, Directory dir) throws IOException, InterruptedException {
    Map<String,Document> docs = new HashMap<String,Document>();
    IndexWriter w = new MockIndexWriter(dir, newIndexWriterConfig(
        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE).setRAMBufferSizeMB(
                                                                                                  0.1).setMaxBufferedDocs(maxBufferedDocs).setMergePolicy(newLogMergePolicy()));
    w.setInfoStream(VERBOSE ? System.out : null);
    w.commit();
    setUseCompoundFile(w.getConfig().getMergePolicy(), false);
    setMergeFactor(w.getConfig().getMergePolicy(), mergeFactor);
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

    for(int iter=0;iter<3;iter++) {
      if (VERBOSE) {
        System.out.println("TEST: iter=" + iter);
      }
      IndexWriter w = new MockIndexWriter(dir, newIndexWriterConfig(
          TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setOpenMode(OpenMode.CREATE)
               .setRAMBufferSizeMB(0.1).setMaxBufferedDocs(maxBufferedDocs).setMaxThreadStates(maxThreadStates)
               .setReaderPooling(doReaderPooling).setMergePolicy(newLogMergePolicy()));
      w.setInfoStream(VERBOSE ? System.out : null);
      setUseCompoundFile(w.getConfig().getMergePolicy(), false);
      setMergeFactor(w.getConfig().getMergePolicy(), mergeFactor);
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

    return docs;
  }

 
  public static void indexSerial(Random random, Map<String,Document> docs, Directory dir) throws IOException {
    IndexWriter w = new IndexWriter(dir, LuceneTestCase.newIndexWriterConfig(random, TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT)).setMergePolicy(newLogMergePolicy()));

    // index all docs in a single thread
    Iterator<Document> iter = docs.values().iterator();
    while (iter.hasNext()) {
      Document d = iter.next();
View Full Code Here

Examples of org.apache.lucene.analysis.WhitespaceAnalyzer

 
  public void testDeleteLeftoverFiles() throws IOException {
    MockDirectoryWrapper dir = newDirectory();
    dir.setPreventDoubleWrite(false);
    IndexWriterConfig conf = newIndexWriterConfig(
        TEST_VERSION_CURRENT, new WhitespaceAnalyzer(TEST_VERSION_CURRENT))
        .setMaxBufferedDocs(10);
    LogMergePolicy mergePolicy = newLogMergePolicy(true, 10);
    mergePolicy.setNoCFSRatio(1); // This test expects all of its segments to be in CFS
    conf.setMergePolicy(mergePolicy);
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.