fix for search result page navigation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4431 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 7404256997
commit a1e9e6e2e6

@ -31,7 +31,6 @@
<input type="hidden" name="count" value="#[count]#" /> <input type="hidden" name="count" value="#[count]#" />
<input type="hidden" name="offset" value="#[offset]#" /> <input type="hidden" name="offset" value="#[offset]#" />
<input type="hidden" name="resource" value="#[resource]#" /> <input type="hidden" name="resource" value="#[resource]#" />
<input type="hidden" name="time" value="#[time]#" />
<input type="hidden" name="urlmaskfilter" value="#[urlmaskfilter]#" /> <input type="hidden" name="urlmaskfilter" value="#[urlmaskfilter]#" />
<input type="hidden" name="prefermaskfilter" value="#[prefermaskfilter]#" /> <input type="hidden" name="prefermaskfilter" value="#[prefermaskfilter]#" />
<input type="hidden" name="depth" value="#[depth]#" /> <input type="hidden" name="depth" value="#[depth]#" />

@ -318,10 +318,11 @@ public class yacysearch {
sb.localSearchTracker.put(client, handles); sb.localSearchTracker.put(client, handles);
prop = new serverObjects(); prop = new serverObjects();
int totalcount = theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize();
prop.put("num-results_offset", offset); prop.put("num-results_offset", offset);
prop.put("num-results_itemscount", "0"); prop.put("num-results_itemscount", "0");
prop.put("num-results_itemsPerPage", itemsPerPage); prop.put("num-results_itemsPerPage", itemsPerPage);
prop.put("num-results_totalcount", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(), !rss)); prop.put("num-results_totalcount", yFormatter.number(totalcount, !rss));
prop.put("num-results_globalresults", (globalsearch) ? "1" : "0"); prop.put("num-results_globalresults", (globalsearch) ? "1" : "0");
prop.put("num-results_globalresults_localResourceSize", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize(), !rss)); prop.put("num-results_globalresults_localResourceSize", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize(), !rss));
prop.put("num-results_globalresults_remoteResourceSize", yFormatter.number(theSearch.getRankingResult().getRemoteResourceSize(), !rss)); prop.put("num-results_globalresults_remoteResourceSize", yFormatter.number(theSearch.getRankingResult().getRemoteResourceSize(), !rss));
@ -335,7 +336,7 @@ public class yacysearch {
resnav.append(navurla(thispage - 1, display, theQuery)); resnav.append(navurla(thispage - 1, display, theQuery));
resnav.append("<strong>&lt;</strong></a>&nbsp;"); resnav.append("<strong>&lt;</strong></a>&nbsp;");
} }
int numberofpages = Math.min(10, Math.min(thispage + 2, (theSearch.getRankingResult().getRemoteResourceSize() + theSearch.getRankingResult().getLocalResourceSize()) / theQuery.displayResults())); int numberofpages = Math.min(10, Math.max(thispage + 2, totalcount / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) { for (int i = 0; i < numberofpages; i++) {
if (i == thispage) { if (i == thispage) {
resnav.append("<strong>"); resnav.append("<strong>");

@ -85,7 +85,8 @@ public class yacysearchitem {
// dynamically update count values // dynamically update count values
if (!rss) { if (!rss) {
prop.put("dynamic_offset", theQuery.neededResults() - theQuery.displayResults() + 1); int offset = theQuery.neededResults() - theQuery.displayResults() + 1;
prop.put("dynamic_offset", offset);
prop.put("dynamic_itemscount", (item < 0) ? theQuery.neededResults() : item + 1); prop.put("dynamic_itemscount", (item < 0) ? theQuery.neededResults() : item + 1);
prop.put("dynamic_totalcount", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(), !rss)); prop.put("dynamic_totalcount", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize() + theSearch.getRankingResult().getRemoteResourceSize(), !rss));
prop.put("dynamic_localResourceSize", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize(), !rss)); prop.put("dynamic_localResourceSize", yFormatter.number(theSearch.getRankingResult().getLocalResourceSize(), !rss));
@ -284,4 +285,5 @@ public class yacysearchitem {
if (p < 0) return s.substring(0, length - 3) + "..."; if (p < 0) return s.substring(0, length - 3) + "...";
return s.substring(0, length - (s.length() - p) - 3) + "..." + s.substring(p); return s.substring(0, length - (s.length() - p) - 3) + "..." + s.substring(p);
} }
} }

@ -181,7 +181,7 @@ public class indexCollectionRI implements indexRI {
public void addMultipleEntries(List<indexContainer> containerList) { public void addMultipleEntries(List<indexContainer> containerList) {
try { try {
for (int i = 0; i < containerList.size(); i++) collectionIndex.merge((indexContainer) containerList.get(i)); for (int i = 0; i < containerList.size(); i++) collectionIndex.merge(containerList.get(i));
//collectionIndex.mergeMultiple(containerList); //collectionIndex.mergeMultiple(containerList);
} catch (kelondroOutOfLimitsException e) { } catch (kelondroOutOfLimitsException e) {
e.printStackTrace(); e.printStackTrace();

@ -371,6 +371,7 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implement
byte[] cp = new byte[Math.min(alength, a.length - aoffset)]; byte[] cp = new byte[Math.min(alength, a.length - aoffset)];
for (int i = cp.length - 1; i >= 0; i--) { for (int i = cp.length - 1; i >= 0; i--) {
cp[i] = ahpla[a[aoffset + i]]; cp[i] = ahpla[a[aoffset + i]];
assert cp[i] != -1;
} }
return cp; return cp;
} }

@ -440,12 +440,14 @@ public class kelondroEcoTable implements kelondroIndex {
if (i == index.size() - 1) { if (i == index.size() - 1) {
// special handling if the entry is the last entry in the file // special handling if the entry is the last entry in the file
index.removei(key); ix = index.removei(key);
assert ix == i;
table.removeRow(i, false); table.removeRow(i, false);
file.cleanLast(); file.cleanLast();
} else { } else {
// switch values // switch values
index.removei(key); ix = index.removei(key);
assert ix == i;
kelondroRow.Entry te = table.removeOne(); kelondroRow.Entry te = table.removeOne();
table.set(i, te); table.set(i, te);

@ -496,7 +496,10 @@ public class kelondroRowCollection {
isort(L, R, swapspace); isort(L, R, swapspace);
return; return;
} }
assert R > L;
int p = partition(L, R, S, swapspace); int p = partition(L, R, S, swapspace);
assert p > L;
assert p < R;
qsort(L, p, 0, swapspace); qsort(L, p, 0, swapspace);
qsort(p, R, 0, swapspace); qsort(p, R, 0, swapspace);
} }

@ -248,9 +248,6 @@ public final class plasmaWordIndex implements indexRI {
if (c != null) containerList.add(c); if (c != null) containerList.add(c);
} }
// flush the containers // flush the containers
for (int i = 0; i < containerList.size(); i++) {
collections.addEntries((indexContainer) containerList.get(i));
}
collections.addMultipleEntries(containerList); collections.addMultipleEntries(containerList);
//System.out.println("DEBUG-Finished flush of " + count + " entries from RAM to DB in " + (System.currentTimeMillis() - start) + " milliseconds"); //System.out.println("DEBUG-Finished flush of " + count + " entries from RAM to DB in " + (System.currentTimeMillis() - start) + " milliseconds");
busyCacheFlush = false; busyCacheFlush = false;

Loading…
Cancel
Save