得到有一定fieldName的所有lucene的值 [英] Get all lucene values that have a certain fieldName

查看:330
本文介绍了得到有一定fieldName的所有lucene的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要解决的我创建了一个问题新的Lucene索引,其中每个领域的所有可能distincted值seperatly索引。

To solve this problem I created a new Lucene index where all possible distincted values of each field are indexed seperatly.

所以这是一个几千的文档具有单个期限的指数。

口要提取的所有值一定期限。例如,我想具有字段名的companyName的所有值。

定义WildcardQuery是关闭的当然不是一个解决方案。无论是枚举所有领域,既节约了正确的字段名的人。

So it's an index with a few thousand docs that have a single Term.
I want to extract all the values for a certain term. For example, I would like all values that have the fieldName "companyName".
Defining a WildcardQuery is off course not a solution. Neither is enumerating ALL fields and only saving the ones with the correct fieldName.

推荐答案

这应该工作(我需要它,它仍然是在C#)

This should work (I take it it still is in C#)

IndexReader.Open(/* path to index */).Terms(new Term("companyName", String.Empty));

这篇关于得到有一定fieldName的所有lucene的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆