how to find the title which is repeated among two different content path using querybuilder | Community
Skip to main content
Level 2
June 24, 2020
Solved

how to find the title which is repeated among two different content path using querybuilder

  • June 24, 2020
  • 4 replies
  • 2979 views

Hi,

how to find the title which is repeated among two different content path using querybuilder in aem 6.5.

i need this result as com.day.cq.search.result.SearchResult result. i am using this result object for pagination, total cound , exeution time in search results.

i have tried with below approach

- i have using the below constrainsts and getting the results then assign to one list and finding the repeated title then using result list. but while doing pagination and total count its giving worng data.

predicate:

1_group.1_path=/content/med/en/hm/pa/comm
1_group.2_path=/content/med/en/hw/pa/comm
1_group.p.or=true
p.limit=10
p.excerpt=false
orderby.sort=desc
p.offset=0,
2_property=jcr:content/policy-details/number

2_property.value=D-666
orderby=@jcr:content/policy-details/version
type=cq:Page

but i want to achieve this in query itself. 

could you please give me right direction.

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Reply from @nareshkumarpart 

Thanks, Vaibhavi, Actually I have written the utility to remove the duplicates and setting the node property. So after that, I have matching the predicates in our application to fetch the records in a search. it gives somehow better performance, and without affecting the pagination logic.

 

@nareshkumarpart Can you please share some more details about this utility for posterity?

4 replies

Vaibhavi_J
Level 7
June 24, 2020

Hi @nareshkumarpart 

 

In below query offset and plimit value is statically set. So during pagination you are not receiving the proper count. 

 

Solution:

Please update the offset and plimit value dynamically. Example:From above query,in first iteration you have received the results from 0(offset is set to 0)to 10(plimit is set for 10 records). In second iteration you should fetch next 10 result, so your offset should be updated to 10 and plimit as 20.

This should fix your issue. 

Below summarizing for better understanding:

  • p.offset defines start of index means from which index you want to fetch records from query result.
  • p.limit defines how many records you want to fetch.
  • Each query result will display results from p.offset to p.offset + p.limit.

Regards, 

Vaibhavi

Level 2
June 25, 2020

Thanks vaibhavi for your response. 

- Actually the issue , Same title presents in two different content path. i want to make it one and show it in results.

Is there any way to find the repeated title in two different path . Any join quires can achieve this using query builder.

If i get the answer for this i can resolve this issue..

 

Thanks in advance for your responses.

Vaibhavi_J
Level 7
June 25, 2020

Hi Naresh,

I got your problem. Query will return both the result as path is different and data will not be treated as duplicate. But you have a way to filter. 

After you get result you can filter out the duplicates by comparing duplicate titles. 

 

 

arunpatidar
Community Advisor
Community Advisor
June 25, 2020

Use SQL2 queries to perform complex comparison.

Arun Patidar
kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
June 29, 2020

Reply from @nareshkumarpart 

Thanks, Vaibhavi, Actually I have written the utility to remove the duplicates and setting the node property. So after that, I have matching the predicates in our application to fetch the records in a search. it gives somehow better performance, and without affecting the pagination logic.

 

@nareshkumarpart Can you please share some more details about this utility for posterity?

Kautuk Sahni