Changeset 32729
- Timestamp:
- 2019-01-31T16:38:12+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/indexers/lucene-gs/src/org/greenstone/LuceneWrapper4/GS2LuceneQuery.java
r32641 r32729 592 592 static protected boolean query_result_caching_enabled = false; 593 593 594 594 /** 595 * This main() method is used by GS2 to do searches. 596 * In GS2, lucene_query.pl calles this main() method in the LuceneWrapper4.jar. This main method instantiates both 597 * a GS2LuceneQuery and an IndexReader object. It then passes the reader to the GS2LuceneQuery object by calling 598 * the GS2LuceneQuery.initialise(reader) method. This main() method then finally performs the search with the provided query. 599 * GS3 doesn't use this main() method. Instead a GS2LuceneSearch object (of gsdl3.jar) instantiates both 600 * the GS2LuceneQuery and IndexReader objects and proceeds the same way. 601 */ 595 602 static public void main (String args[]) 596 603 { … … 660 667 } 661 668 662 if (!queryer.initialise()) { 663 queryer.cleanUp(); // will close reader object IF reader was instantiated 669 Directory full_indexdir_dir = FSDirectory.open(new File(index_directory)); 670 IndexReader reader = DirectoryReader.open(full_indexdir_dir); // Returns a IndexReader reading the index in the given Directory. 671 // Now readOnly=true by default, and therefore also for searcher created in initialise() call below. 672 if (!queryer.initialise(reader)) { 673 if(reader != null) reader.close(); // close reader object IF reader was instantiated 674 queryer.cleanUp(); // will close searcher object if non-null 664 675 return; 665 676 } … … 684 695 } 685 696 } 686 queryer.cleanUp(); 697 if(reader != null) reader.close(); 698 queryer.cleanUp(); 687 699 } 688 700 catch (IOException exception) {
Note:
See TracChangeset
for help on using the changeset viewer.