lucene IndexOptions可以设置DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS DOCS,ES里也可以设置
org.apache.lucene.index
Enum Constants Enum Constant and Description DOCS_AND_FREQSOnly documents and term frequencies are indexed: positions are omitted.DOCS_AND_FREQS_AND_POSITIONSIndexes documents, frequencies and positions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETSIndexes documents, frequencies, positions and offsets.DOCS_ONLYOnly documents are indexed: term frequencies and positions are omitted.
Java Code Examples for org.apache.lucene.index.IndexOptions
| Project: languagetool File: EmptyLuceneIndexCreator.java View source code | 6 votes | ![]() ![]() |
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.out.println("Usage: " + EmptyLuceneIndexCreator.class.getSimpleName() + " <indexPath>");
System.exit(1);
}
Analyzer analyzer = new StandardAnalyzer();
IndexWriterConfig config = new IndexWriterConfig(analyzer);
Directory directory = FSDirectory.open(new File(args[0]).toPath());
IndexWriter writer = new IndexWriter(directory, config);
FieldType fieldType = new FieldType();
fieldType.setIndexOptions(IndexOptions.DOCS);
fieldType.setStored(true);
Field countField = new Field("totalTokenCount", String.valueOf(0), fieldType);
Document doc = new Document();
doc.add(countField);
writer.addDocument(doc);
writer.close();
}
index_options are "options" for the index you are searching on, a
datastructure that holds "terms" to document lists (posting lists).
TermVectors are a datastructure that gives you the "terms" for a given
document and in addition their position in the document as well as their
start and end character offsets. Now the index (each field has such an
index) holds a sorted list of terms and each term points to a posting list.
these posting lists are a list of documents that contain the term. On the
posting list you can also store information like frequencies (how often did
term Y occur in document X -> useful for scoring) as well as "positions"
(at which position did term Y occur in document X -> this is required fo
phrase & span queries).
if you have for instance a field that you only use for filtering you don't
need freqs and postions so documents only will do the job. In an index the
position information is the biggest piece of data usually aside stored
fields. If you don't do phrase queries or spans you don't need them at all
so safe the disk space and improve perf by only use docs and freqs. In
previous version it wasn't possible to have only freqs but no positions
(index_options supersede omit_term_frequencies_and_positions) so this is an
improvement overall since the most common usecase might only need freqs but
no positions.
1:term_vector
TermVector.YES: Only store number of occurrences.
TermVector.WITH_POSITIONS: Store number of occurrence and positions of terms, but no offset.
TermVector.WITH_OFFSETS: Store number of occurrence and offsets of terms, but no positions.
TermVector.WITH_POSITIONS_OFFSETS:number of occurrence and positions , offsets of terms.
TermVector.NO:Don't store any term vector information.
2: index_options
Allows to set the indexing options, possible values are docs (only doc numbers are indexed), freqs (doc numbers and term frequencies), and positions (doc numbers, term frequencies and positions). Defaults to positions for analyzed fields, and to docs for not_analyzed fields. It is also possible to set it to offsets (doc numbers, term frequencies, positions and offsets).
lucene IndexOptions可以设置DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS DOCS,ES里也可以设置的更多相关文章
- ES里设置索引中倒排列表仅仅存文档ID——采用docs存储后可以降低pos文件和cfs文件大小
index_options The index_options parameter controls what information is added to the inverted index, ...
- 在package.json里面的script设置环境变量,区分开发及生产环境。注意mac与windows的设置方式不一样
在package.json里面的script设置环境变量,区分开发及生产环境. 注意mac与windows的设置方式不一样. "scripts": { "publish- ...
- 导航栏和里面的View设置的是同一颜色值,实际运行又不一样.
导航栏和里面的View设置的是同一颜色值,实际运行又不一样.如何保证两者的颜色一致呢? 答案就是:( navigationBar.translucent = NO; ) 去除 导航条的分割线(黑 ...
- 14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置
14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置 locking read, 一个UPDATE,或 ...
- Ubuntu里字符编码设置
Ubuntu里字符编码设置 Ubuntu系统在默认的状况下只支持中文UTF-8编码,但是我们写的一些文档,还有java代码编译时采用gbk编码.所以需要修改.步骤如下: www.2cto.com ...
- spring里的事物设置
有的人说事物在spring里设置有两种,其实事物设置在spring配置文件中共有五种方式:第一种方式:每个Bean都有一个代理第二种方式:所有Bean共享一个代理基类第三种方式:使用拦截器第四种方式: ...
- FL studio里的项目设置介绍
FL studio作为具有众多音乐功能,能够制作多轨音频录制,排序和混音的一款专业软件,我们可以借助VST主机,灵活的调音台,高级MIDI和ReWire支持,来创建专业品质的各种音乐曲目. 而今天我们 ...
- Android ViewPager里的所有图片设置监听打开同一活动显示不同图片
Android ViewPager里的所有图片设置监听请看前一文章 为了省时所以2层菜单只做一个点击任意图片后显示相应图片的活动 关键点是每个点击对应的图片如何传参给显示的活动 因为只启动一个活动,所 ...
- 在tomcat启动时解析xml文件,获取特定标签的属性值,并将属性值设置到静态变量里
这里以解析hibernate.cfg.xml数据库配置信息为例,运用dom4j的解析方式来解析xml文件. 1.在javaWeb工程里新建一个java类,命名为GetXmlValue.java,为xm ...
随机推荐
- Springboot2.x整合Redis以及连接哨兵模式/集群模式
依赖: <!--spirngboot版本为2.x--><!-- 加载spring boot redis包,springboot2.0中直接使用jedis或者lettuce配置连接池, ...
- github上更新fork的别人的项目
直接上解决方案的步骤 (1)在自己fork后的项目的位置上,点击New pull request. (2)比较和原创版本(base)的变化 (3 ) compare across forks. 使得左 ...
- c# dynamic实现动态实体,不用定义实体就能序列化为标准json
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...
- iOS滤镜功能
一.iOS自带滤镜 1.CoreImage 使用苹果自带的CoreImage框架对图片进行处理,用CoreImage框架里的CIFilter对图片进行滤镜处理, 首先我们应该了解下CoreImage框 ...
- java - day019 - 反射
网络程序,难点在线程 反射 reflect 实用 类对象 来执行反射操作 反射获得一个类的定义信息 反射创建对象 反射调用成员变量, 方法 方法 获得类对象的三种方式 A.class Class.fo ...
- git使用方法(持续更新)
2018/5/9 最基本的操作: 添加文件.文件夹.所有文件: git add test.py //添加单个文件 git add src //添加文件夹 git add . ...
- Windows 在 git bash下使用 conda 命令
1. 安装git 安装连接:http://git-scm.com/download/linux (LINUX) https://git-scm.com/downloads (Windows) 2. ...
- GlusterFS分布式存储系统
一,分布式文件系统理论基础 1.1 分布式文件系统出现 计算机通过文件系统管理,存储数据,而现在数据信息爆炸的时代中人们可以获取的数据成指数倍的增长,单纯通过增加硬盘个数来扩展计算机文件系统的存储容量 ...
- 模板引擎-vue中的模板如何被解析,指令如何处理
模板是什么 <div id='app'> <div> <input v-model="title"/> <button v-on:clic ...
- 使用C#应用程序与Arduino开发板进行通信
在本文中,我们将一个Arduino Pro Mini开发板连接到PC,并且使用C# Windows应用程序与其进行通信. 将硬件连接到PC是非常有利的,不仅是因为你可以发送命令以及监控状态,还可以实时 ...

