[zz]lucene index 包分析

xiaoxiao2021-03-01  14

Index包分析 转载自http://www.gamvan.com/club/clubPage.jsp?ccStyle=0&tID=10633&ccID=37 Lucene索引中有几个最基础的概念,索引(index),文档(document),域(field),和项(或者译为语词term) 其中Index为Document的序列   Document为Field的序列  Field为Term的序列 Term就是一个子串.存在于不同的Field中的同一个子串被认为是不同的Term.因此Term实际上是用一对子串表示的,第一个子串为Field的name,第二个为Field中的子串.既然Term这么重要,我们先来认识一下Term. 认识Term最好的方法就是看其源码表示. public final class Term implements Comparable, java.io.Serializable {   String field;   String text;   public Term(String fld, String txt) {this(fld, txt, true);}   public final String field() { return field; }   public final String text() { return text; }   //overwrite equals()   public final boolean equals(Object o) { }   //overwrite hashCode()   public final int hashCode() {r        return field.hashCode() + text.hashCode();   }   public int compareTo(Object other) {       return compareTo((Term)other);   }   public final int compareTo(Term other)   final void set(String fld, String txt)  public final String toString() {          return field + ":" + text;    }   private void readObject(java.io.ObjectInputStream in){   } 从代码中我们可以大体看出Tern其实是一个二元组
转载请注明原文地址: https://www.6miu.com/read-3850293.html

最新回复(0)