Lucene搜索具有特定字段的文档? [英] Lucene Search for documents that have a particular field?

查看:73
本文介绍了Lucene搜索具有特定字段的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Lucene.Net- 有没有一种方法可以查询包含特定字段的文档.

Lucene.Net - Is there a way to query for documents that contain a particular field.

让我们说一些文档的字段为'foo',而有些则没有.

Lets say some of my documents have a field 'foo' and some do not.

我想查找所有具有'foo'字段的文档-不管foo的值是什么.

I want to find all documents that have the field 'foo' - regardless of what the value of foo is.

我该怎么做?是某种TermQuery吗?

How do I do this? Is it some sort of TermQuery?

推荐答案

尝试foo:[* TO *] 应该适用于字段'foo'的所有非空值

Try foo:[* TO *] should work for all non-null values of field 'foo'

这篇关于Lucene搜索具有特定字段的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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