Commits

bazaarvoice committed bdb4ba9

Fix handling of page cache when page size is not 25

  • Participants
  • Parent commits 16cf7d5

Comments (0)

Files changed (2)

File pagesize-cache-fix

+# HG changeset patch
+# Parent 2bf2a477ea893a10f6728a64653b1920f95b2866
+diff -r 2bf2a477ea89 -r 99c7851b3982 web/api.jsp
+--- a/web/api.jsp	Thu Mar 29 10:10:24 2012 -0500
++++ b/web/api.jsp	Thu Mar 29 11:06:10 2012 -0500
+@@ -208,7 +208,7 @@
+                 TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage * cachePages, docsScoredInOrder);
+                 searcher.search(query, collector);
+                 totalHits = collector.getTotalHits();
+-                if (start >= hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
++                if (start + max > hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
+                     collector = TopScoreDocCollector.create(totalHits, docsScoredInOrder);
+                     searcher.search(query, collector);
+                 }
+@@ -222,7 +222,7 @@
+                 }
+                 TopFieldDocs fdocs = searcher.search(query, null, hitsPerPage * cachePages, sortField);
+                 totalHits = fdocs.totalHits;
+-                if (start >= hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
++                if (start + max > hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
+                     fdocs = searcher.search(query, null, totalHits, sortField);
+                 }
+                 hits = fdocs.scoreDocs;
+diff -r 2bf2a477ea89 -r 99c7851b3982 web/search.jsp
+--- a/web/search.jsp	Thu Mar 29 10:10:24 2012 -0500
++++ b/web/search.jsp	Thu Mar 29 11:06:10 2012 -0500
+@@ -208,7 +208,7 @@
+                 TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage * cachePages, docsScoredInOrder);
+                 searcher.search(query, collector);
+                 totalHits = collector.getTotalHits();
+-                if (start >= hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
++                if (start + max > hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
+                     collector = TopScoreDocCollector.create(totalHits, docsScoredInOrder);
+                     searcher.search(query, collector);
+                 }
+@@ -222,7 +222,7 @@
+                 }
+                 TopFieldDocs fdocs = searcher.search(query, null, hitsPerPage * cachePages, sortField);
+                 totalHits = fdocs.totalHits;
+-                if (start >= hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
++                if (start + max > hitsPerPage * cachePages) { //fetch ALL results only if above cachePages
+                     fdocs = searcher.search(query, null, totalHits, sortField);
+                 }
+                 hits = fdocs.scoreDocs;
 page-size
 bazaarvoice-customizations
 search-json-api
+pagesize-cache-fix