wudan
wudan

Reputation: 203

How to get all documents of lucene index?

I have created a lucene index .

I would like to get all documents that just according to a field sorting and no search terms!

Upvotes: 20

Views: 28857

Answers (3)

swingbit
swingbit

Reputation: 2745

The class MatchAllDocsQuery looks like what you need to retrieve all documents: https://lucene.apache.org/core/4_4_0/core/org/apache/lucene/search/MatchAllDocsQuery.html

Upvotes: 13

Andriy
Andriy

Reputation: 1027

Please specify q=*:* as a search term

Upvotes: 14

suat
suat

Reputation: 4289

I don't know your Lucene versions match but the answer at 1 may work for you. See 2 for another thread including another approach.

Is it possible to iterate through documents stored in Lucene Index?
http://lucene.472066.n3.nabble.com/Iterating-over-all-documents-in-an-index-td2480114.html

Upvotes: 4

Related Questions