Changeset 29167 for main/trunk/greenstone2
- Timestamp:
- 2014-07-31T14:00:03+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/indexers/lucene-gs/src/org/greenstone/LuceneWrapper4/GS2LuceneQuery.java
r29148 r29167 266 266 int term_freq = 0; 267 267 int match_docs = 0; 268 269 int docID = -1; 270 while((docID = term_docs.nextDoc()) != DocsEnum.NO_MORE_DOCS) {//while (term_docs.next()) 271 if (term_docs.freq() != 0) 272 { 273 term_freq += term_docs.freq(); 274 match_docs++; 275 276 // Calculate the document-level term frequency as well 277 Integer lucene_doc_num_obj = new Integer(term_docs.docID()); 278 int doc_term_freq = 0; 279 if (doc_term_freq_map.containsKey(lucene_doc_num_obj)) 280 { 281 doc_term_freq = ((Integer) doc_term_freq_map.get(lucene_doc_num_obj)).intValue(); 282 } 283 doc_term_freq += term_docs.freq(); 284 285 doc_term_freq_map.put(lucene_doc_num_obj, new Integer(doc_term_freq)); 286 } 268 269 if(term_docs != null) { 270 int docID = -1; 271 while((docID = term_docs.nextDoc()) != DocsEnum.NO_MORE_DOCS) {//while (term_docs.next()) 272 if (term_docs.freq() != 0) 273 { 274 term_freq += term_docs.freq(); 275 match_docs++; 276 277 // Calculate the document-level term frequency as well 278 Integer lucene_doc_num_obj = new Integer(term_docs.docID()); 279 int doc_term_freq = 0; 280 if (doc_term_freq_map.containsKey(lucene_doc_num_obj)) 281 { 282 doc_term_freq = ((Integer) doc_term_freq_map.get(lucene_doc_num_obj)).intValue(); 283 } 284 doc_term_freq += term_docs.freq(); 285 286 doc_term_freq_map.put(lucene_doc_num_obj, new Integer(doc_term_freq)); 287 } 288 } 289 } else { 290 System.err.println("@@@ GS2LuceneQuery.java: term_docs is null for term " + term.text()); 287 291 } 288 292 … … 302 306 } 303 307 304 // do the query 308 // Extracting all documents for a given search - http://www.gossamer-threads.com/lists/lucene/java-user/134873 309 // http://lucene.apache.org/core/3_4_0/api/core/org/apache/lucene/search/TotalHitCountCollector.html 310 // http://lucene.apache.org/core/4_7_2/core/index.html?org/apache/lucene/search/TopFieldDocs.html 311 312 // 1. Figure out how many results there will be. 313 //TotalHitCountCollecter countCollector = new TotalHitCountCollector(); 314 //searcher.search(query, filter, collector); 315 //int hitCount = collector.count; 316 317 // Actually do the query 305 318 // Simple case for getting all the matching documents 306 319 if (end_results == Integer.MAX_VALUE) {
Note:
See TracChangeset
for help on using the changeset viewer.