Revision 3368
Added by Jing Tao over 17 years ago
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
87 | 87 |
// Capacity of the query result cache |
88 | 88 |
private static final int QUERYRESULTCACHESIZE = Integer.parseInt(MetaCatUtil.getOption("queryresult_cache_size")); |
89 | 89 |
|
90 |
// Size of page for non paged query |
|
91 |
private static final int NONPAGESIZE = 99999999; |
|
90 | 92 |
/** |
91 | 93 |
* the main routine used to test the DBQuery utility. |
92 | 94 |
* <p> |
... | ... | |
480 | 482 |
boolean lastpage = false; |
481 | 483 |
int rev = 0; |
482 | 484 |
double startTime = 0; |
483 |
//int offset = 1;
|
|
485 |
int offset = 1; |
|
484 | 486 |
double startSelectionTime = System.currentTimeMillis()/1000; |
485 | 487 |
ResultSet rs = null; |
486 |
|
|
487 |
//offset = 1; |
|
488 |
// this is a hack for offset |
|
489 |
/*if (out == null) |
|
488 |
|
|
489 |
|
|
490 |
// this is a hack for offset. in postgresql 7, if the returned docid list is too long, |
|
491 |
//the extend query which base on the docid will be too long to be run. So we |
|
492 |
// have to cut them into different parts. Page query don't need it somehow. |
|
493 |
if (out == null) |
|
490 | 494 |
{ |
491 | 495 |
// for html page, we put everything into one page |
492 | 496 |
offset = |
... | ... | |
496 | 500 |
{ |
497 | 501 |
offset = |
498 | 502 |
(new Integer(MetaCatUtil.getOption("app_resultsetsize"))).intValue(); |
499 |
}*/
|
|
503 |
} |
|
500 | 504 |
|
501 | 505 |
/* |
502 | 506 |
* Check the docidOverride Vector |
... | ... | |
574 | 578 |
|
575 | 579 |
if(pagesize == 0) |
576 | 580 |
{ //this makes sure we get all results if there is no paging |
577 |
pagesize = 9999999;
|
|
578 |
pagestart = 9999999;
|
|
581 |
pagesize = NONPAGESIZE;
|
|
582 |
pagestart = NONPAGESIZE;
|
|
579 | 583 |
} |
580 | 584 |
|
581 | 585 |
int currentIndex = 0; |
... | ... | |
628 | 632 |
|
629 | 633 |
// when doclist reached the offset number, send out doc list and empty |
630 | 634 |
// the hash table |
631 |
/*if (count == offset && pagesize == 0)
|
|
635 |
if (count == offset && pagesize == NONPAGESIZE)
|
|
632 | 636 |
{ //if pagesize is not 0, do this later. |
633 | 637 |
//reset count |
634 | 638 |
//logMetacat.warn("############doing subset cache"); |
... | ... | |
637 | 641 |
user, groups,dbconn, useXMLIndex); |
638 | 642 |
//reset docListResult |
639 | 643 |
docListResult = new ResultDocumentSet(); |
640 |
}*/
|
|
644 |
} |
|
641 | 645 |
|
642 | 646 |
logMetacat.info("currentIndex: " + currentIndex); |
643 | 647 |
logMetacat.info("page comparator: " + (pagesize * pagestart) + pagesize); |
... | ... | |
658 | 662 |
{ |
659 | 663 |
ResultDocumentSet pagedResultsHash = new ResultDocumentSet(); |
660 | 664 |
//get the last page of information then break |
661 |
if(pagesize != 9999999)
|
|
665 |
if(pagesize != NONPAGESIZE)
|
|
662 | 666 |
{ |
663 | 667 |
for(int i=pagesize*pagestart; i<docListResult.size(); i++) |
664 | 668 |
{ |
... | ... | |
696 | 700 |
|
697 | 701 |
// now we only cached none-paged query and user is public |
698 | 702 |
if (user != null && user.equalsIgnoreCase("public") |
699 |
&& pagesize == 9999999 && MetaCatUtil.getOption("query_cache_on").equals("true"))
|
|
703 |
&& pagesize == NONPAGESIZE && MetaCatUtil.getOption("query_cache_on").equals("true"))
|
|
700 | 704 |
{ |
701 | 705 |
//System.out.println("the string stored into cache is "+ resultsetBuffer.toString()); |
702 | 706 |
storeQueryResultIntoCache(selectionAndExtendedQuery, resultsetBuffer.toString()); |
Also available in: Unified diff
Add code to handle the docid list is too long to be run in extended query.