Mercurial Hosting > luan
comparison src/luan/modules/lucene/LuceneIndex.java @ 1541:dc23c96f5021
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 13 Sep 2020 15:50:52 -0600 |
parents | 79f67662d3e7 |
children | 1db694d98003 |
comparison
equal
deleted
inserted
replaced
1540:79f67662d3e7 | 1541:dc23c96f5021 |
---|---|
117 return li; | 117 return li; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 private static final Version luceneVersion = Version.LUCENE_4_9; | 121 private static final Version luceneVersion = Version.LUCENE_4_9; |
122 // private static final String FLD_NEXT_ID = "nextId"; | |
123 public static final StringFieldParser STRING_FIELD_PARSER = new StringFieldParser(new KeywordAnalyzer()); | 122 public static final StringFieldParser STRING_FIELD_PARSER = new StringFieldParser(new KeywordAnalyzer()); |
124 public static final StringFieldParser LOWERCASE_FIELD_PARSER = new StringFieldParser(new LowercaseAnalyzer(luceneVersion)); | 123 public static final StringFieldParser LOWERCASE_FIELD_PARSER = new StringFieldParser(new LowercaseAnalyzer(luceneVersion)); |
125 public static final StringFieldParser ENGLISH_FIELD_PARSER = new StringFieldParser(new EnglishAnalyzer(luceneVersion)); | 124 public static final StringFieldParser ENGLISH_FIELD_PARSER = new StringFieldParser(new EnglishAnalyzer(luceneVersion)); |
126 private static final SortField ID_SORT = new SortField("id",SortField.Type.LONG); | 125 private static final SortField ID_SORT = new SortField("id",SortField.Type.LONG); |
127 private static final SortField ID_DESC_SORT = new SortField("id",SortField.Type.LONG,true); | 126 private static final SortField ID_DESC_SORT = new SortField("id",SortField.Type.LONG,true); |
365 | 364 |
366 | 365 |
367 private long id; | 366 private long id; |
368 | 367 |
369 private void initId() throws IOException { | 368 private void initId() throws IOException { |
370 // TopDocs td = searcher.search(new TermQuery(new Term("type","next_id")),1); | |
371 writer.deleteDocuments(new TermQuery(new Term("type","next_id"))); | |
372 writer.commit(); | |
373 | |
374 TopDocs td = searcher.search(new MatchAllDocsQuery(),1,new Sort(ID_DESC_SORT)); | 369 TopDocs td = searcher.search(new MatchAllDocsQuery(),1,new Sort(ID_DESC_SORT)); |
375 switch(td.scoreDocs.length) { | 370 switch(td.scoreDocs.length) { |
376 case 0: | 371 case 0: |
377 id = 0; | 372 id = 0; |
378 break; | 373 break; |