LP1860044 Angular catalog search result highlights
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / catalog / record / pagination.component.ts
index 88214cd..038679a 100644 (file)
@@ -137,17 +137,23 @@ export class RecordPaginationComponent implements OnInit {
             return Promise.resolve();
         }
 
-        const origPager = this.searchContext.pager;
+        const ctx = this.searchContext;
+
+        const origPager = ctx.pager;
         const tmpPager = new Pager();
         tmpPager.limit = limit || 1000;
 
-        this.searchContext.pager = tmpPager;
+        ctx.pager = tmpPager;
+
+        // Avoid fetching highlight data for a potentially large
+        // list of record IDs
+        ctx.getHighlightsFor = this.id;
 
-        return this.cat.search(this.searchContext)
-        .then(
-            ok => this.searchContext.pager = origPager,
-            notOk => this.searchContext.pager = origPager
-        );
+        return this.cat.search(ctx)
+        .then(_ => {
+            ctx.pager = origPager;
+            ctx.getHighlightsFor = null;
+        });
     }
 
     returnToSearch(): void {