Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 752
wudan Avatar asked Aug 27 '11 00:08

wudan


3 Answers

Please specify q=*:* as a search term

like image 139
Andriy Avatar answered Oct 01 '22 01:10

Andriy


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

like image 40
cornuz Avatar answered Oct 01 '22 03:10

cornuz


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

like image 5
suat Avatar answered Oct 01 '22 03:10

suat