Package org.apache.lucene.analysis.core

Examples of org.apache.lucene.analysis.core.WhitespaceAnalyzer


  }

  @Override
  protected void setUp() throws Exception {
    directory = new RAMDirectory();
    analyzer = new WhitespaceAnalyzer(Version.LUCENE_43);
    selectionProperties = new HashMap<String, String>();
    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, analyzer);
    conf.setOpenMode(OpenMode.CREATE);
    IndexWriter writer = new IndexWriter(directory, conf);
View Full Code Here


    assertEquals(facets.get(3).getFacetValueHitCount(), 1);
  }

  private void modifiedSetup() throws CorruptIndexException, LockObtainFailedException, IOException {
    directory = new RAMDirectory();
    analyzer = new WhitespaceAnalyzer(Version.LUCENE_43);
    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_43, analyzer);
    conf.setOpenMode(OpenMode.CREATE);
    IndexWriter writer = new IndexWriter(directory, conf);

    writer.addDocument(doc("prop1=val1", "prop2=val1", "prop5=val1"));
View Full Code Here

  }

  @Override
  protected void setUp() throws Exception {
    directory = new RAMDirectory();
    analyzer = new WhitespaceAnalyzer(Version.LUCENE_43);
    IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, analyzer);
    config.setOpenMode(OpenMode.CREATE);
    IndexWriter writer = new IndexWriter(directory, config);
    Document doc = new Document();
    addMetaDataField(doc, PathHandlerName, new String[] { "/a/b/c", "/a/b/d" });
View Full Code Here

  }
 
  public static void deletePendingFiles(Directory dir, IndexDeletionPolicy policy) throws Exception {
    SegmentInfos infos = new SegmentInfos();
    infos.read(dir);
    IndexWriterConfig cfg = new IndexWriterConfig(Luke.LV, new WhitespaceAnalyzer());
    IndexWriter iw = new IndexWriter(dir, cfg);
    IndexFileDeleter deleter = new IndexFileDeleter(dir, policy, infos, null, iw, true);
    deleter.close();
    iw.close();
  }
View Full Code Here

    _showUserData(dialog);
  }
 
  private IndexWriter createIndexWriter() {
    try {
      IndexWriterConfig cfg = new IndexWriterConfig(LV, new WhitespaceAnalyzer());
      IndexDeletionPolicy policy;
      if (keepCommits) {
        policy = new KeepAllIndexDeletionPolicy();
      } else {
        policy = new KeepLastIndexDeletionPolicy();
View Full Code Here

      }

      if (ramdir) {
        showStatus("Loading index into RAMDirectory ...");
        Directory dir1 = new RAMDirectory();
        IndexWriterConfig cfg = new IndexWriterConfig(LV, new WhitespaceAnalyzer());
        IndexWriter iw1 = new IndexWriter(dir1, cfg);
        iw1.addIndexes((Directory[])dirs.toArray(new Directory[dirs.size()]));
        iw1.close();
        showStatus("RAMDirectory loading done!");
        if (dir != null) dir.close();
View Full Code Here

          if (keep) {
            policy = new KeepAllIndexDeletionPolicy();
          } else {
            policy = new KeepLastIndexDeletionPolicy();
          }
          IndexWriterConfig cfg = new IndexWriterConfig(LV, new WhitespaceAnalyzer());
          if (!useLast) {
            IndexCommit ic = ((DirectoryReader)ir).getIndexCommit();
            if (ic != null) {
              cfg.setIndexCommit(ic);
            }
View Full Code Here

extends NodeAnalyzerTestCase<JsonAnalyzer> {

  @Override
  protected JsonAnalyzer getNodeAnalyzer() {
    final Analyzer literalAnalyzer = new StandardAnalyzer(TEST_VERSION_CURRENT);
    final Analyzer fieldAnalyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
    return new JsonAnalyzer(TEST_VERSION_CURRENT, fieldAnalyzer, literalAnalyzer);
  }
View Full Code Here

  }

  @Test
  public void testBoolean()
  throws Exception {
    _a.registerDatatype(XSDDatatype.XSD_BOOLEAN.toCharArray(), new WhitespaceAnalyzer(TEST_VERSION_CURRENT));
    this.assertAnalyzesTo(_a, "{\"foo\":[true,false]}",
      new String[] { "foo", "true", "false" },
      new String[] { TypeAttribute.DEFAULT_TYPE, TypeAttribute.DEFAULT_TYPE,
                     TypeAttribute.DEFAULT_TYPE });
  }
View Full Code Here

  @Override
  protected void configure() throws IOException {
    final AnyURIAnalyzer uriAnalyzer = new AnyURIAnalyzer(TEST_VERSION_CURRENT);
    final TupleAnalyzer tupleAnalyzer = new TupleAnalyzer(TEST_VERSION_CURRENT,
      new WhitespaceAnalyzer(TEST_VERSION_CURRENT), uriAnalyzer);
    tupleAnalyzer.registerDatatype(XSDDatatype.XSD_ANY_URI.toCharArray(), uriAnalyzer);
    this.setAnalyzer(tupleAnalyzer);
    this.setPostingsFormat(PostingsFormatType.RANDOM);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.core.WhitespaceAnalyzer

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.