Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Query Builder

Avatar

Level 7

Root predicate group.........p.guessTotal=true

if i used this in my query it is showing me

Number of hits: 158

if i used

p.limit=-1

Number of hits: 158  same

differnece is p.limit will show all results and p.guessTotal will show only 10 (default).

but in docx I have read like

p.guessTotal=true  is recommended because its avoid calculating the full result total which can be costly;

but in both cases it is calculating total so how  it can reduce the cost ?It is calculating in both cases but showing in one and hiding the result in another ?

Please correct me if i wrong

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

When you use p.guessTotal, then Query is execute and get only results which you specify as guessTotal but in case of p.limit, it returns all the results.

Example: if there are 1000 of targeted items and if you use

1. p.guessTotal = 10

Query will be execting to get top 10 results like SELECT TOP 10 column FROM table

2. p.limit=10

Query will be execting to get all results and 10 results will be shown like select * from table



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor
  • p.limit : Limits the number of search results fetched.
  • p.offset : Sets the offset for the search results
  • p.guesstotal : The purpose of p.guessTotal parameter is to return the appropriate number of results that can be shown by combining the minimum viable p.offset and p.limit values.


Arun Patidar

Avatar

Level 7

Arun Patidar

Thanks for your response.

  • p.guesstotal : The purpose of p.guessTotal parameter is to return the appropriate number of results that can be shown by combining the minimum viable p.offset and p.limit values.

If this is the purpose then this can be achievable without using p.guessTotal

by default also we will get if we wont put any (p.)parameter ....

by default also we will get p.offset=0 and p.limit=10 and that combination only p.guessTotal are providing.

Same result I am fetching whether  p.guessTotal  is present in my query or not...

Avatar

Correct answer by
Community Advisor

Hi,

When you use p.guessTotal, then Query is execute and get only results which you specify as guessTotal but in case of p.limit, it returns all the results.

Example: if there are 1000 of targeted items and if you use

1. p.guessTotal = 10

Query will be execting to get top 10 results like SELECT TOP 10 column FROM table

2. p.limit=10

Query will be execting to get all results and 10 results will be shown like select * from table



Arun Patidar