[zz]lucene index 包分析

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其实是一个二元组
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值