Changeset 16443
- Timestamp:
- 2008-07-17T16:20:14+12:00 (15 years ago)
- Location:
- indexers/trunk/lucene-gs/src/org/greenstone/LuceneWrapper
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
indexers/trunk/lucene-gs/src/org/greenstone/LuceneWrapper/GS2LuceneQuery.java
r16015 r16443 187 187 for (int i = start_results; i <= hits.length(); i++) { 188 188 Document doc = hits.doc(i - 1); 189 lucene_query_result.addDoc( Long.parseLong(doc.get("nodeID").trim()), hits.score(i-1));189 lucene_query_result.addDoc(doc.get("nodeID").trim(), hits.score(i-1)); 190 190 } 191 191 } … … 203 203 for (int i = start_results; (i <= hits.scoreDocs.length && i <= end_results); i++) { 204 204 Document doc = reader.document(hits.scoreDocs[i - 1].doc); 205 lucene_query_result.addDoc( Long.parseLong(doc.get("nodeID").trim()), hits.scoreDocs[i-1].score);205 lucene_query_result.addDoc(doc.get("nodeID").trim(), hits.scoreDocs[i-1].score); 206 206 } 207 207 } -
indexers/trunk/lucene-gs/src/org/greenstone/LuceneWrapper/LuceneQueryResult.java
r13686 r16443 110 110 } 111 111 112 public void addDoc( long doc, float rank) {113 DocInfo doc_info = new DocInfo(doc, rank); 114 docs_.add( doc_info);112 public void addDoc(String id, float rank) 113 { 114 docs_.add(new DocInfo(id, rank)); 115 115 } 116 116 … … 220 220 } 221 221 222 public class DocInfo { 223 224 public long num_=0; 225 public float rank_=0; 226 227 public DocInfo(long doc, float rank) { 228 num_=doc; 229 rank_=rank; 230 } 231 public String toString(){ 232 return ""+num_+"("+rank_+")"; 233 } 234 public String toXMLString() { 235 return "<Match id=\"" + num_ + "\" rank=\"" + rank_ +"\" />"; 236 } 237 } 222 223 public class DocInfo 224 { 225 public String id_ = ""; 226 public float rank_ = 0; 227 228 public DocInfo (String id, float rank) 229 { 230 id_ = id; 231 rank_ = rank; 232 } 233 234 public String toString() 235 { 236 return "" + id_ + " (" + rank_ + ")"; 237 } 238 239 public String toXMLString() 240 { 241 return "<Match id=\"" + id_ + "\" rank=\"" + rank_ + "\" />"; 242 } 243 } 244 238 245 239 246 // where should this go??? 240 241 247 public static String xmlSafe(String text) { 242 248 text = text.replaceAll("&","&amp;");
Note:
See TracChangeset
for help on using the changeset viewer.