Revision 3263
Added by Jing Tao over 17 years ago
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
595 | 595 |
npstmt.execute(); |
596 | 596 |
ResultSet btrs = npstmt.getResultSet(); |
597 | 597 |
boolean hasBtRows = btrs.next(); |
598 |
Hashtable list = new Hashtable(); |
|
598 |
//Hashtable list = new Hashtable();
|
|
599 | 599 |
while (hasBtRows) |
600 | 600 |
{ |
601 | 601 |
//there was a backtrackable document found |
... | ... | |
634 | 634 |
continue; |
635 | 635 |
} |
636 | 636 |
docid = docid_org.trim(); |
637 |
if (list.containsKey(docid)) |
|
637 |
/*if (list.containsKey(docid))
|
|
638 | 638 |
{ |
639 | 639 |
logMetacat.info("DocumentResultSet already has docid "+docid+" and skip it"); |
640 | 640 |
hasBtRows = btrs.next(); |
641 | 641 |
continue; |
642 |
} |
|
642 |
}*/
|
|
643 | 643 |
docname = xmldoc.getDocname(); |
644 | 644 |
doctype = xmldoc.getDoctype(); |
645 | 645 |
createDate = xmldoc.getCreateDate(); |
... | ... | |
672 | 672 |
docListResult.addResultDocument( |
673 | 673 |
new ResultDocument(docid, (String) document.toString())); |
674 | 674 |
currentIndex++; |
675 |
list.put(docid, docid); |
|
675 |
//list.put(docid, docid);
|
|
676 | 676 |
//logMetacat.warn("$$$$$$$real result: " + docid); |
677 | 677 |
count++; |
678 | 678 |
|
... | ... | |
889 | 889 |
pstmt.execute(); |
890 | 890 |
pstmt.close(); |
891 | 891 |
} |
892 |
double endStoreReturnField = System.currentTimeMillis()/1000; |
|
893 |
logMetacat.warn("Time to store new return fields into xml_queryresult table (Part4 in return fields) " |
|
894 |
+ (endStoreReturnField -startStoreReturnField)); |
|
892 |
|
|
895 | 893 |
// A string with element |
896 | 894 |
String xmlElement = " <document>" + element + "</document>"; |
897 | 895 |
|
... | ... | |
902 | 900 |
} |
903 | 901 |
resultset.append(xmlElement); |
904 | 902 |
}//while |
905 |
|
|
906 |
|
|
903 |
|
|
904 |
double endStoreReturnField = System.currentTimeMillis()/1000; |
|
905 |
logMetacat.warn("Time to store new return fields into xml_queryresult table (Part4 in return fields) " |
|
906 |
+ (endStoreReturnField -startStoreReturnField)); |
|
907 |
|
|
907 | 908 |
Enumeration keysE = queryresultDocList.keys(); |
908 | 909 |
while (keysE.hasMoreElements()) |
909 | 910 |
{ |
... | ... | |
1305 | 1306 |
} |
1306 | 1307 |
document.append("</triple>"); |
1307 | 1308 |
|
1308 |
String removedelement = (String) docListResult.remove(docidkey);
|
|
1309 |
docListResult.put(docidkey, removedelement+ document.toString());
|
|
1309 |
String removedelement = (String) docListResult.get(docidkey);
|
|
1310 |
docListResult.set(docidkey, removedelement+ document.toString());
|
|
1310 | 1311 |
tableHasRows = rs.next(); |
1311 | 1312 |
}//while |
1312 | 1313 |
rs.close(); |
1313 | 1314 |
pstmt.close(); |
1315 |
|
|
1314 | 1316 |
}//while |
1315 | 1317 |
double endRelation = System.currentTimeMillis() / 1000; |
1316 | 1318 |
logMetacat.info("Time to add relationship to return fields (part 3 in return fields): " |
... | ... | |
2522 | 2524 |
public void addResultDocument(ResultDocument rd) |
2523 | 2525 |
{ |
2524 | 2526 |
if(rd.docid == null) |
2525 |
rd.docid = "";
|
|
2527 |
return;
|
|
2526 | 2528 |
if(rd.document == null) |
2527 | 2529 |
rd.document = ""; |
2528 |
|
|
2529 |
docids.addElement(rd.docid); |
|
2530 |
documents.addElement(rd.document); |
|
2530 |
if (!containsDocid(rd.docid)) |
|
2531 |
{ |
|
2532 |
docids.addElement(rd.docid); |
|
2533 |
documents.addElement(rd.document); |
|
2534 |
} |
|
2531 | 2535 |
} |
2532 | 2536 |
|
2533 | 2537 |
/** |
... | ... | |
2650 | 2654 |
} |
2651 | 2655 |
return s; |
2652 | 2656 |
} |
2657 |
/* |
|
2658 |
* Set a new document value for a given docid |
|
2659 |
*/ |
|
2660 |
public void set(String docid, String document) |
|
2661 |
{ |
|
2662 |
for(int i=0; i<docids.size(); i++) |
|
2663 |
{ |
|
2664 |
String docid0 = (String)docids.elementAt(i); |
|
2665 |
if(docid0.trim().equals(docid.trim())) |
|
2666 |
{ |
|
2667 |
documents.set(i, document); |
|
2668 |
} |
|
2669 |
} |
|
2670 |
|
|
2671 |
} |
|
2653 | 2672 |
} |
2654 | 2673 |
} |
Also available in: Unified diff
Fixed bug that search "soil" will cause an exception.