Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.Analyzer


      }
    }

    /* Create a Query for each condition */
    BooleanQuery fieldQuery = null;
    Analyzer analyzer = Indexer.createAnalyzer();
    for (ISearchCondition condition : conditions) {

      /* State and Scope Queries already handled */
      if (requiresStateGrouping(condition) || isScopeCondition(condition))
        continue;
View Full Code Here


    int runs = Integer.parseInt(args[1])// e.g. 3
    Document doc = new Builder().build(new File(args[2])); // e.g. "data/samples/randj.xml"
    String path = args[3]; // e.g. "//line"
    String queryExpr = args[4]; // e.g. "Capul* thou"
   
    Analyzer textAnalyzer = PatternAnalyzer.DEFAULT_ANALYZER;
    Analyzer queryAnalyzer = PatternAnalyzer.DEFAULT_ANALYZER;
   
    String field = "f";
    Nodes lines = XQueryUtil.xquery(doc, path);
    System.out.println("lines=" + lines.size());
    MemoryIndex[] indexes = new MemoryIndex[lines.size()];
View Full Code Here

   */
  private void doIndex() throws InterruptedException{
    try {
      File tempIndexDir = new File(tempIndexPath);
      Directory indexPath = FSDirectory.open(new File(tempIndexDir, "main"));
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
      indexWriter = new IndexWriter(indexPath, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
      indexWriter.deleteAll();
      indexWriter.setMergeFactor(INDEX_MERGE_FACTOR); //for better performance
      // Create IndexWriterWorker
      log.info("Running with " + numberIndexWriter + " IndexerWriterWorker");
View Full Code Here

    return SearchResults.EMPTY_SEARCH_RESULTS;
  }
 
  protected Set<String> getHighlightWords(String searchString) {
    try {
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
      TokenStream stream = analyzer.tokenStream("content", new StringReader(searchString));
      TermAttribute termAtt = (TermAttribute) stream.addAttribute(TermAttribute.class);
      for (boolean next = stream.incrementToken(); next; next = stream.incrementToken()) {
        String term = termAtt.term();
        if(log.isDebug()) log.debug(term);
      }
View Full Code Here

  public static void main(String[] args) throws Exception {
    if (args.length != 0) {
      QUERY = args[0];
    }
    // 将庖丁封装成符合Lucene要求的Analyzer规范
    Analyzer analyzer = new PaodingAnalyzer();
   
    //读取本类目录下的text.txt文件
    String content = ContentReader.readText(Chinese.class);

    //接下来是标准的Lucene建立索引和检索的代码
View Full Code Here

  public static void main(String[] args) throws Exception {
    if (args.length != 0) {
      QUERY = args[0];
    }
    // 将庖丁封装成符合Lucene要求的Analyzer规范
    Analyzer analyzer = new PaodingAnalyzer();
   
    //读取本类目录下的text.txt文件
    String content = ContentReader.readText(English.class);

    //接下来是标准的Lucene建立索引和检索的代码
View Full Code Here

    String fieldName = "text";
     //检索内容
    String text = "IK Analyzer是一个结合词典分词和文法分词的中文分词开源工具包。它使用了全新的正向迭代最细粒度切分算法。";
   
    //实例化IKAnalyzer分词器
    Analyzer analyzer = new IKAnalyzer();
  
   
    Directory directory = null;
    IndexWriter iwriter = null;
    IndexSearcher isearcher = null;
View Full Code Here

  public static void main(String[] args) throws Exception {
    if (args.length != 0) {
      QUERY = args[0];
    }
    // 将庖丁封装成符合Lucene要求的Analyzer规范
    Analyzer analyzer = new PaodingAnalyzer();
   
    //读取本类目录下的text.txt文件
    String content = ContentReader.readText(Chinese.class);

    //接下来是标准的Lucene建立索引和检索的代码
View Full Code Here

  public static void main(String[] args) throws Exception {
    if (args.length != 0) {
      QUERY = args[0];
    }
    // 将庖丁封装成符合Lucene要求的Analyzer规范
    Analyzer analyzer = new PaodingAnalyzer();
   
    //读取本类目录下的text.txt文件
    String content = ContentReader.readText(Chinese.class);

    //接下来是标准的Lucene建立索引和检索的代码
View Full Code Here

  public static void main(String[] args) throws Exception {
    if (args.length != 0) {
      QUERY = args[0];
    }
    // 将庖丁封装成符合Lucene要求的Analyzer规范
    Analyzer analyzer = new PaodingAnalyzer();
   
    //读取本类目录下的text.txt文件
    String content = ContentReader.readText(Chinese.class);

    //接下来是标准的Lucene建立索引和检索的代码
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.Analyzer

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.