mukerrem
New Creator

Search G2 row limit

Jump to solution

My question is related "_maxRows" limit with Search G2.

I could not change the maxRows limitation. The max of rows limit is 200.

I have many post and I'm listing the posts with pagination. So, cps.row is 50 and we are listing the posts step by step.

But I need to see all results without pagination. My page has a PDF export option and we have to export all item acording to filter. The export feature has been operating via pdfmyurl API. This API uses the CSS @media print and remove unnecessary styles with this css file and then convert the printable view to a PDF file.

So, when ı provide a URL and a CSS file, the pdfmyurl is return a pdf. Like example link below;
pdfmyurl.com/api?license=key&url=page&css=file

What we have done to solve?

To solve the issue we have added a parameter end of the URL, like showall=true and requested the search queries according to page numbers and append then to a div when exist showall.


But this is not best practice because ordering is wrong. Requests return times are different. We could not find a way to solve asynchronous in Search G2.

We have created an array and collected the data according to request order and then place the data to a result div. But this time pdfmyurl API did not wait the result and exported only empty page.

Could you please provide an approach or solution ?

Labels (3)
0 Kudos
1 Solution

Accepted Solutions
MarcusEdwards
Crownpeak (Retired)

Re: Search G2 row limit

Jump to solution

The SearchG2 Javascript SDK does have a hard-coded limit of 200 rows per page of results. While you could construct a Solr query URL of your own and bypass this limit, there are important considerations on both efficiency and performance with large row numbers or start indexes of the Search G2 service. 

The solution you have attempted (adding the showall parameter) doesn't solve the fundamental problem because you pass the URL to pdfmyurl service but rely on client-side (browser) code to populate the div.

Fundamentally, you need to move away from client-side querying of the search collection. Alternative solutions:

  • Implement your own PDF export in server-side code -- this removes the dependency on the pdfmyurl service at the cost of having to integrate a PDF generation library (consider iText)
  • Implement a server-side "page" that assembles the full HTML to convert to PDF. This page should use Solr cursors to retrieve all the relevant rows from search. The URL to this "export" page can then be passed to pdfmyurl.

 

View solution in original post

2 Replies
MarcusEdwards
Crownpeak (Retired)

Re: Search G2 row limit

Jump to solution

The SearchG2 Javascript SDK does have a hard-coded limit of 200 rows per page of results. While you could construct a Solr query URL of your own and bypass this limit, there are important considerations on both efficiency and performance with large row numbers or start indexes of the Search G2 service. 

The solution you have attempted (adding the showall parameter) doesn't solve the fundamental problem because you pass the URL to pdfmyurl service but rely on client-side (browser) code to populate the div.

Fundamentally, you need to move away from client-side querying of the search collection. Alternative solutions:

  • Implement your own PDF export in server-side code -- this removes the dependency on the pdfmyurl service at the cost of having to integrate a PDF generation library (consider iText)
  • Implement a server-side "page" that assembles the full HTML to convert to PDF. This page should use Solr cursors to retrieve all the relevant rows from search. The URL to this "export" page can then be passed to pdfmyurl.

 

View solution in original post

Divya-S1
New Creator

Search G2 Sorting

Jump to solution

Hello Everyone,

Anyone please suggested the inputs for Search G2 string sorting. I have tried this but didn't helped us "sort=custom_s_heading(home,max)%20desc"

We have a requirement of sorting based on number of occurrence of string value in the search G2 result. 

Search: Plumbing – will try to find how many times plumbing is available in “custom_s_heading”  and sort it based on the number of occurrence. Then find the same in “content” and sort and display.

For example: below are some values of “custom_s_heading”,

Sentence 1: My name is plumbing

Sentence 2: Plumbing can be done with those who knows plumbing works. Plumbing is an easy job.

Sentence 3: My plumbing work is in progress. Plumbing is good.

Since the 2nd sentence is having plumbing 3 times, it will return as first item from the search G2 result followed by sentence 3(2 times word plumbing used) and sentence 1(only 1 time word plumbing used).

0 Kudos