• 大小: 26.69MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-09
  • 语言: Java
  • 标签: Lucene3.0.0  

资源简介

lucene3.0.0jar包、IKAnalyzer分词器jar包及IKAnayzer中文分词器使用手册

资源截图

代码片段和文件信息

package org.apache.lucene.demo;

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License Version 2.0
 * (the “License“); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing software
 * distributed under the License is distributed on an “AS IS“ BASIS
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.File;

import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
//import org.apache.lucene.index.Term;


/** Deletes documents from an index that do not contain a term. */
public class DeleteFiles {
  
  private DeleteFiles() {}                         // singleton

  /** Deletes documents from an index that do not contain a term. */
  public static void main(String[] args) {
    String usage = “java org.apache.lucene.demo.DeleteFiles “;
    if (args.length == 0) {
      System.err.println(“Usage: “ + usage);
      System.exit(1);
    }
    try {
      Directory directory = FSDirectory.open(new File(“index“));
      IndexReader reader = IndexReader.open(directory false); // we don‘t want read-only because we are about to delete

      Term term = new Term(“path“ args[0]);
      int deleted = reader.deleteDocuments(term);

      System.out.println(“deleted “ + deleted +
   “ documents containing “ + term);

      // one can also delete documents by their internal id:
      /*
      for (int i = 0; i < reader.maxDoc(); i++) {
        System.out.println(“Deleting document with id “ + i);
        reader.delete(i);
      }*/

      reader.close();
      directory.close();

    } catch (Exception e) {
      System.out.println(“ caught a “ + e.getClass() +
 “\n with message: “ + e.getMessage());
    }
  }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-11-23 09:08  IKAnalyzer3.2.0Stable_bin\
     目录           0  2017-11-23 09:08  IKAnalyzer3.2.0Stable_bin\doc3.2.0\
     文件        3017  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\allclasses-frame.html
     文件        2677  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\allclasses-noframe.html
     文件       15536  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\constant-values.html
     文件        5331  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\deprecated-list.html
     文件        9669  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\help-doc.html
     目录           0  2017-11-23 09:08  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\
     文件        7613  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-1.html
     文件        9026  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-10.html
     文件       10923  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-11.html
     文件        7494  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-12.html
     文件       10134  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-13.html
     文件        7233  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-14.html
     文件        9045  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-15.html
     文件       10547  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-16.html
     文件        8716  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-17.html
     文件        6728  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-18.html
     文件       10173  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-2.html
     文件        7531  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-3.html
     文件        7370  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-4.html
     文件        7384  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-5.html
     文件       10964  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-6.html
     文件        7481  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-7.html
     文件       15376  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-8.html
     文件        9225  2015-08-21 14:32  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index-files\index-9.html
     文件        1493  2015-08-21 18:26  IKAnalyzer3.2.0Stable_bin\doc3.2.0\index.html
     目录           0  2015-08-21 18:36  IKAnalyzer3.2.0Stable_bin\doc3.2.0\org\
     目录           0  2015-08-21 18:36  IKAnalyzer3.2.0Stable_bin\doc3.2.0\org\wltea\
     目录           0  2017-11-23 09:08  IKAnalyzer3.2.0Stable_bin\doc3.2.0\org\wltea\analyzer\
     目录           0  2017-11-23 09:08  IKAnalyzer3.2.0Stable_bin\doc3.2.0\org\wltea\analyzer\cfg\
............此处省略5961个文件信息

评论

共有 条评论

相关资源