18

I have created a lucene index .

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

suat
  • 4,239
  • 3
  • 28
  • 51
wudan
  • 183
  • 1
  • 1
  • 5

3 Answers3

13

Please specify q=*:* as a search term

Andriy
  • 973
  • 8
  • 13
13

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

cornuz
  • 2,678
  • 18
  • 35
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – user2720864 Jul 07 '15 at 10:54
  • 1
    @user2720864 I think you misunderstood my answer, which started with "How about ..". That was no critique. It was a real suggestion on how to solve the OP's problem. To make it clearer, I rephrased it to remove that expression. Besides the writing style, this is not only a proper answer (they don't always need to be long) but also a very correct answer (unless you can disprove it). – cornuz Jul 07 '15 at 11:19
  • 2
    best answer for this question – makasprzak Sep 24 '15 at 13:07
4

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

Community
  • 1
  • 1
suat
  • 4,239
  • 3
  • 28
  • 51