热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Lucene2.2.0源代码阅读学习(27)

关于Lucene的检索(IndexSearcher)的内容。通过一个例子,然后从例子所涉及到的内容出发,一点点地仔细研究每个类的实现和用法。先写一个

关于Lucene的检索(IndexSearcher)的内容。

通过一个例子,然后从例子所涉及到的内容出发,一点点地仔细研究每个类的实现和用法。

先写一个简单的使用Lucene实现的能够检索的类,如下所示:

package org.shirdrn.lucene;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
import org.apache.lucene.search.Filter;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TermsFilter;

public class MySearcher {

public static void main(String[] args) {
  
   String indexPath = "E:\\Lucene\\myindex";
   try {
    IndexSearcher searcher = new IndexSearcher(indexPath);
    String keyword = "的";
    Term term = new Term("contents",keyword);
    IndexReader indexReader = IndexReader.open(indexPath);
    int numberOfDocumentIncludingGivenTerm = indexReader.docFreq(term);
    System.out.println("IndexReader的版本为 : "+indexReader.getVersion());
    System.out.println("包含词条 ("+term.field()+","+term.text()+") 的Document的数量为 : "+numberOfDocumentIncludingGivenTerm);
    Query query = new TermQuery(term);   
    Date startTime = new Date();   
    Hits hits = searcher.search(query);
    System.out.println("********************************************************************");
    int No = 1;
    for(int i=0;i     System.out.println("【 序号 】: " + No++);
    TermDocs termDocs = searcher.getIndexReader().termDocs(term);
     while(termDocs.next()){
      if(termDocs.doc() == hits.id(i)){
       System.out.println("Document的内部编号为 : "+hits.id(i));
       Document doc = hits.doc(i);
       List fieldList = doc.getFields();
      //System.out.println("==========="+fieldList.size());
       System.out.println("Document(编号) "+hits.id(i)+" 的Field的信息: ");
       System.out.println("    ------------------------------------");
       for(int j=0;j        Fieldable field = (Fieldable)fieldList.get(j);
        System.out.println("    Field的名称为 : "+field.name());
        System.out.println("    Field的内容为 : "+field.stringValue());
        System.out.println("    ------------------------------------");
       }
       System.out.println("Document的内容为 : "+doc);
       System.out.println("Document的得分为 : "+hits.score(i));
       System.out.println("搜索的该关键字【"+keyword+"】在Document(编号) "+hits.id(i)+" 中,出现过 "+termDocs.freq()+" 次");
      }
     }
     System.out.println("********************************************************************");
    }
    Date finishTime = new Date();
    long timeOfSearch = finishTime.getTime() - startTime.getTime();
    System.out.println("本次搜索所用的时间为 "+timeOfSearch+" ms");
   } catch (CorruptIndexException e) {
    e.printStackTrace();
   } catch (IOException e) {
    e.printStackTrace();
   }
}
}

首先要保证索引目录E:\\Lucene\\myindex下面已经存在索引文件,可以通过文章 Lucene-2.2.0 源代码阅读学习(4) 中一个使用Lucene的Demo中的递归建立索引的方法,将建立的索引文件存放到E:\\Lucene\\myindex目录之下。

执行上面的主函数,输出结果如下所示:

IndexReader的版本为 : 1207548172961
包含词条 (contents,的) 的Document的数量为 : 23
********************************************************************
【 序号 】: 1
Document的内部编号为 : 24
Document(编号) 24 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\FAQ.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200604130754
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.5279752
搜索的该关键字【的】在Document(编号) 24 中,出现过 291 次
********************************************************************
【 序号 】: 2
Document的内部编号为 : 5
Document(编号) 5 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\3实验题目.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200710300744
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.5252467
搜索的该关键字【的】在Document(编号) 5 中,出现过 2 次
********************************************************************
【 序号 】: 3
Document的内部编号为 : 12
Document(编号) 12 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\CustomKeyInfo.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200406041814
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.51790017
搜索的该关键字【的】在Document(编号) 12 中,出现过 70 次
********************************************************************
【 序号 】: 4
Document的内部编号为 : 41
Document(编号) 41 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\Update.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200707050028
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.5059122
搜索的该关键字【的】在Document(编号) 41 中,出现过 171 次
********************************************************************
【 序号 】: 5
Document的内部编号为 : 0
Document(编号) 0 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\120E升级包安装说明.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200803271123
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.43770555
搜索的该关键字【的】在Document(编号) 0 中,出现过 2 次
********************************************************************
【 序号 】: 6
Document的内部编号为 : 3
Document(编号) 3 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\1实验题目.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200710160733
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.4333064
搜索的该关键字【的】在Document(编号) 3 中,出现过 1 次
********************************************************************
【 序号 】: 7
Document的内部编号为 : 60
Document(编号) 60 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\猫吉又有个忙,需要大家帮忙一下.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200706161112
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.4106042
搜索的该关键字【的】在Document(编号) 60 中,出现过 11 次
********************************************************************
【 序号 】: 8
Document的内部编号为 : 59
Document(编号) 59 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\汉化说明.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200708210247
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.39057708
搜索的该关键字【的】在Document(编号) 59 中,出现过 13 次
********************************************************************
【 序号 】: 9
Document的内部编号为 : 44
Document(编号) 44 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\Visual Studio 2005注册升级.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200801300512
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.37525433
搜索的该关键字【的】在Document(编号) 44 中,出现过 3 次
********************************************************************
【 序号 】: 10
Document的内部编号为 : 56
Document(编号) 56 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\新1建 文本文档.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200710311142
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.36621076
搜索的该关键字【的】在Document(编号) 56 中,出现过 35 次
********************************************************************
【 序号 】: 11
Document的内部编号为 : 46
Document(编号) 46 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\使用技巧集萃.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200511210413
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.35693806
搜索的该关键字【的】在Document(编号) 46 中,出现过 133 次
********************************************************************
【 序号 】: 12
Document的内部编号为 : 30
Document(编号) 30 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\MyEclipse 注册码.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200712061059
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.3460366
搜索的该关键字【的】在Document(编号) 30 中,出现过 5 次
********************************************************************
【 序号 】: 13
Document的内部编号为 : 63
Document(编号) 63 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\疑问即时记录.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200711141408
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.30325133
搜索的该关键字【的】在Document(编号) 63 中,出现过 6 次
********************************************************************
【 序号 】: 14
Document的内部编号为 : 37
Document(编号) 37 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\readme.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200803101314
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.26262334
搜索的该关键字【的】在Document(编号) 37 中,出现过 8 次
********************************************************************
【 序号 】: 15
Document的内部编号为 : 48
Document(编号) 48 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\剑心补丁使用说明(readme).txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200803101357
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.26262334
搜索的该关键字【的】在Document(编号) 48 中,出现过 8 次
********************************************************************
【 序号 】: 16
Document的内部编号为 : 47
Document(编号) 47 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\关系记录.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200802201145
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.23161201
搜索的该关键字【的】在Document(编号) 47 中,出现过 14 次
********************************************************************
【 序号 】: 17
Document的内部编号为 : 40
Document(编号) 40 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\Struts之AddressBooks学习笔记.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200710131711
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.21885277
搜索的该关键字【的】在Document(编号) 40 中,出现过 8 次
********************************************************************
【 序号 】: 18
Document的内部编号为 : 51
Document(编号) 51 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\密码强度检验.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200712010901
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.12380183
搜索的该关键字【的】在Document(编号) 51 中,出现过 1 次
********************************************************************
【 序号 】: 19
Document的内部编号为 : 50
Document(编号) 50 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\史上最强天籁之声及欧美流行曲超级精选【 FLAC分轨】.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200712231241
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.1083266
搜索的该关键字【的】在Document(编号) 50 中,出现过 1 次
********************************************************************
【 序号 】: 20
Document的内部编号为 : 57
Document(编号) 57 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\新建 文本文档.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200710270258
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.09285137
搜索的该关键字【的】在Document(编号) 57 中,出现过 4 次
********************************************************************
【 序号 】: 21
Document的内部编号为 : 45
Document(编号) 45 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\书籍网站.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200708071255
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.0670097
搜索的该关键字【的】在Document(编号) 45 中,出现过 3 次
********************************************************************
【 序号 】: 22
Document的内部编号为 : 61
Document(编号) 61 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\网络查询大全.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200111200655
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.065655835
搜索的该关键字【的】在Document(编号) 61 中,出现过 2 次
********************************************************************
【 序号 】: 23
Document的内部编号为 : 14
Document(编号) 14 的Field的信息:
    ------------------------------------
    Field的名称为 : path
    Field的内容为 : E:\Lucene\txt1\mytxt\CustomKeysSample.txt
    ------------------------------------
    Field的名称为 : modified
    Field的内容为 : 200610100451
    ------------------------------------
Document的内容为 : Document stored/uncompressed,indexed>
Document的得分为 : 0.051179506
搜索的该关键字【的】在Document(编号) 14 中,出现过 7 次
********************************************************************
本次搜索所用的时间为 187 ms

 

其中,IndexReader是一个用于读取索引文件的抽象类,可以参考该类的源代码。IndexReader类可以很方便地打开一个索引目录(即创建一个输入流),这要使用到它的静态(static)方法open()打开即可,然后就可以访问索引文件了,从而实现对索引文件的维护。

IndexReader类实现了各种打开索引文件的方式,由于定义为static的,所以非常方便地调用,如下所示:

public static IndexReader open(String path) throws CorruptIndexException, IOException {    // 通过String的索引目录的路径
    return open(FSDirectory.getDirectory(path), true, null);
}

public static IndexReader open(File path) throws CorruptIndexException, IOException {    // 通过File构造的索引目录文件
    return open(FSDirectory.getDirectory(path), true, null);
}

public static IndexReader open(final Directory directory) throws CorruptIndexException, IOException { // 直接通过Directory来打开
    return open(directory, false, null);
}

public static IndexReader open(final Directory directory, IndexDeletionPolicy deletionPolicy) throws CorruptIndexException, IOException { // 直接通过Directory来打开,并指定一种索引文件删除策略,可以对索引文件进行维护(删除操作)

    return open(directory, false, deletionPolicy);
}

其中,最核心的实现是在一个私有的open()方法中实现的,如下所示:

private static IndexReader open(final Directory directory, final boolean closeDirectory, final IndexDeletionPolicy deletionPolicy) throws CorruptIndexException, IOException {

    return (IndexReader) new SegmentInfos.FindSegmentsFile(directory) {

      protected Object doBody(String segmentFileName) throws CorruptIndexException, IOException {

        SegmentInfos infos = new SegmentInfos();
        infos.read(directory, segmentFileName);

        IndexReader reader;

        if (infos.size() == 1) {    // index is optimized
          reader = SegmentReader.get(infos, infos.info(0), closeDirectory);
        } else {

         // To reduce the chance of hitting FileNotFound
          // (and having to retry), we open segments in
          // reverse because IndexWriter merges & deletes
          // the newest segments first.

          IndexReader[] readers = new IndexReader[infos.size()];
          for (int i = infos.size()-1; i >= 0; i--) {
            try {
              readers[i] = SegmentReader.get(infos.info(i));
            } catch (IOException e) {
             
// Close all readers we had opened:
              for(i++;i                readers[i].close();
              }
              throw e;
            }
          }

          reader = new MultiReader(directory, infos, closeDirectory, readers);
        }
        reader.deletionPolicy = deletionPolicy;
        return reader;
      }
    }.run();
}

上面测试程序中,IndexSearcher类是实现检索的核心类。它提供了很多中不同的检索方式,返回的对象也可以适用于不同的需要,比如Hits、TopFieldDocs、TopDocs,而且,还可以指定排序Sort、权重Weight、过滤器Filter作为search()方法的参数,用起来的灵活、方便。

通过程序中,红色标注的代码行:

TermDocs termDocs = searcher.getIndexReader().termDocs(term);

其实,一个IndexSearcher实例化以后,可以通过它获取到一个IndexReader的实例,从而打开一个索引目录。

然后从就可以从创建的输入流中读取索引文件的详细信息:

1、每个Document的内部编号(是唯一的,可以通过这个编号对其进行维护);

2、每个Document中都有多个Field,可以读取Field的名称、路径、Field的内容等等。

上面的测试程序中,没有输出名称为“contents”的Field,是因为在索引文件中没有存储Fielde的内容(即文本信息)。因为Field的内容是根据从指定的数据源中获取,而数据源可能是数据量非常大的一些文件,如果直接将它们保存到索引文件中,会占用很大的磁盘空间。

其实,可以根据需要存储。上面之所以没有存储,可以追溯到Lucene自带的Demo中的设置,在org.apache.lucene.demo.FileDocument中创建Field,如下所示:

    // 构造一个Field,这个Field可以从一个文件流中读取,必须保证由f所构造的文件流是打开的
    doc.add(new Field("contents", new FileReader(f)));

然后,看Field的该构造方法的定义:

public Field(String name, Reader reader) {
    this(name, reader, TermVector.NO);
}

这个构造方法指定了要为这个创建的Field进行分词、索引,但是不存储。

可以参考调用的另一个构造方法:

public Field(String name, Reader reader, TermVector termVector) {
    if (name == null)
      throw new NullPointerException("name cannot be null");
    if (reader == null)
      throw new NullPointerException("reader cannot be null");
   
    this.name = name.intern();       
// field names are interned
    this.fieldsData = reader;
   
    this.isStored = false;   
// 指定不进行存储
    this.isCompressed = false;
   
    this.isIndexed = true;   
// 要进行索引
    this.isTokenized = true;    // 要进行分词
   
    this.isBinary = false;
   
    setStoreTermVector(termVector);
}

上面测试程序中,Hits是一个内容非常丰富的实现类。

通过检索返回Hits类的对象,可以通过Hits类的实例来获取Document的id,以及计算该Document的得分,并且在search()执行之后,返回的结果按照得分的高低来排序输出,得分值高的在前面。

以此做个引子,之后再详细学习研究。


推荐阅读
  • 本文讨论了在shiro java配置中加入Shiro listener后启动失败的问题。作者引入了一系列jar包,并在web.xml中配置了相关内容,但启动后却无法正常运行。文章提供了具体引入的jar包和web.xml的配置内容,并指出可能的错误原因。该问题可能与jar包版本不兼容、web.xml配置错误等有关。 ... [详细]
  • 第四章高阶函数(参数传递、高阶函数、lambda表达式)(python进阶)的讲解和应用
    本文主要讲解了第四章高阶函数(参数传递、高阶函数、lambda表达式)的相关知识,包括函数参数传递机制和赋值机制、引用传递的概念和应用、默认参数的定义和使用等内容。同时介绍了高阶函数和lambda表达式的概念,并给出了一些实例代码进行演示。对于想要进一步提升python编程能力的读者来说,本文将是一个不错的学习资料。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 本文介绍了使用Spark实现低配版高斯朴素贝叶斯模型的原因和原理。随着数据量的增大,单机上运行高斯朴素贝叶斯模型会变得很慢,因此考虑使用Spark来加速运行。然而,Spark的MLlib并没有实现高斯朴素贝叶斯模型,因此需要自己动手实现。文章还介绍了朴素贝叶斯的原理和公式,并对具有多个特征和类别的模型进行了讨论。最后,作者总结了实现低配版高斯朴素贝叶斯模型的步骤。 ... [详细]
  • 大数据Hadoop生态(20)MapReduce框架原理OutputFormat的开发笔记
    本文介绍了大数据Hadoop生态(20)MapReduce框架原理OutputFormat的开发笔记,包括outputFormat接口实现类、自定义outputFormat步骤和案例。案例中将包含nty的日志输出到nty.log文件,其他日志输出到other.log文件。同时提供了一些相关网址供参考。 ... [详细]
  • 如何使用Python从工程图图像中提取底部的方法?
    本文介绍了使用Python从工程图图像中提取底部的方法。首先将输入图片转换为灰度图像,并进行高斯模糊和阈值处理。然后通过填充潜在的轮廓以及使用轮廓逼近和矩形核进行过滤,去除非矩形轮廓。最后通过查找轮廓并使用轮廓近似、宽高比和轮廓区域进行过滤,隔离所需的底部轮廓,并使用Numpy切片提取底部模板部分。 ... [详细]
  • 本文介绍了C++中省略号类型和参数个数不确定函数参数的使用方法,并提供了一个范例。通过宏定义的方式,可以方便地处理不定参数的情况。文章中给出了具体的代码实现,并对代码进行了解释和说明。这对于需要处理不定参数的情况的程序员来说,是一个很有用的参考资料。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • 本文介绍了如何在给定的有序字符序列中插入新字符,并保持序列的有序性。通过示例代码演示了插入过程,以及插入后的字符序列。 ... [详细]
  • javascript  – 概述在Firefox上无法正常工作
    我试图提出一些自定义大纲,以达到一些Web可访问性建议.但我不能用Firefox制作.这就是它在Chrome上的外观:而那个图标实际上是一个锚点.在Firefox上,它只概述了整个 ... [详细]
  • Sleuth+zipkin链路追踪SpringCloud微服务的解决方案
    在庞大的微服务群中,随着业务扩展,微服务个数增多,系统调用链路复杂化。Sleuth+zipkin是解决SpringCloud微服务定位和追踪的方案。通过TraceId将不同服务调用的日志串联起来,实现请求链路跟踪。通过Feign调用和Request传递TraceId,将整个调用链路的服务日志归组合并,提供定位和追踪的功能。 ... [详细]
  • 本文介绍了解决java开源项目apache commons email简单使用报错的方法,包括使用正确的JAR包和正确的代码配置,以及相关参数的设置。详细介绍了如何使用apache commons email发送邮件。 ... [详细]
author-avatar
ian
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有