您当前的位置: 首页 > 

qq_34412985

暂无认证

  • 0浏览

    0关注

    1061博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

lucene中Field简介

qq_34412985 发布时间:2019-12-09 20:38:53 ,浏览量:0

Lucene 6.1.0中存在的field种类如下(后缀是Field):

下面介绍几个常用的Field类型:

  • TextField

A field that is indexed and tokenized, without term vectors. For example this would be used on a 'body' field, that contains the bulk of a document's text.   是一个会自动被索引和分词的字段。一般被用在文章的正文部分。

  • StringField

A field that is indexed but not tokenized: the entire String value is indexed as a single token. For example this might be used for a 'country' field or an 'id' field. If you also need to sort on this field, separately add a SortedDocValuesField to your document.  StringField会被索引,但是不会被分词,即会被当作一个完整的token处理,一般用在“国家”或者“ID”.

  • StoredField

A field whose value is stored so that IndexSearcher.doc(int) and IndexReader.document() will return the field and its value.   也就是一个默认会被存储的Field。

举个例子 (下面是对新闻数据进行索引的过程,数据存储在MySQL数据库中,title列存文章标题,content存正文,url存文章所在的链接,author是文章的作者)

关注
打赏
1653291990
查看更多评论
立即登录/注册

微信扫码登录

0.0424s