QueryBuilder APi list all the pages as a search results if it finds the keyword atleast once in the Search criteria in the Page content.
But if we need to search for twice occurance in the page content, How to get the keyword search result count to find how many times the keyword exist in the page content?
You help in this regard will be really appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
I don't know whether this helps or not but if you do this query:
path=/your/path property=text property.operation=like property.value=%keyword% orderby:path p.limit=-1
You should see the list of components where the keyword appears ordered by path, which means that if you look at the list of results, you should see pages where the keyword appears in more than one component.
It would be bad luck if it appears twice in the same component, but you could do this to find that out:
path=/your/path property=text property.operation=like property.value=%keyword%keyword%
Hope that helps
Views
Replies
Total Likes
I doubt if you have that option in Querybuilder (others can comment). but once you get the resultset from the querybuilder, you can use string operation and filter the result set
Views
Replies
Total Likes
I don't know whether this helps or not but if you do this query:
path=/your/path property=text property.operation=like property.value=%keyword% orderby:path p.limit=-1
You should see the list of components where the keyword appears ordered by path, which means that if you look at the list of results, you should see pages where the keyword appears in more than one component.
It would be bad luck if it appears twice in the same component, but you could do this to find that out:
path=/your/path property=text property.operation=like property.value=%keyword%keyword%
Hope that helps
Views
Replies
Total Likes
gcarlino wrote...
I don't know whether this helps or not but if you do this query:
path=/your/path
property=text
property.operation=like
property.value=%keyword%
orderby:path
p.limit=-1
You should see the list of components where the keyword appears ordered by path, which means that if you look at the list of results, you should see pages where the keyword appears in more than one component.
It would be bad luck if it appears twice in the same component, but you could do this to find that out:
path=/your/path
property=text
property.operation=like
property.value=%keyword%keyword%
Hope that helps
Sorry I tried the solution provided but it doesn't solve my problem. Please let me know the correct syntax please. and also what is the exact sytax for sorting by path? I am not able to set the sorting by path in my code.
Also without sorting my path i am not getting any result for these query parameters mentioned in your solution.
I want to understand how to find a keyword occurs twice in a page content, it may be twice in one component or not does not matter for me, as my requirement is to consider only pages which has the keyword which appears more than one time in the page content.
Any pointer to achieve this solution will greatly appreciated.
Thanks in advance.
Views
Replies
Total Likes
bsloki wrote...
I doubt if you have that option in Querybuilder (others can comment). but once you get the resultset from the querybuilder, you can use string operation and filter the result set
Can you please elaborate more on this approach . If the result of the querybuilder picks all the pages with minimum one occurrence of the search keyword in the entire page. So from this result how do we use the string operation and i dentify which of the results have more than one occurance of the keyword?
Views
Replies
Total Likes
I will give you a specific example of what I'm trying to say. I'm doing this in a default installation, on a local instance, here: http://localhost:4502/libs/cq/search/content/querydebug.html
You enter this and click Search button:
path=/content/geometrixx property=text property.operation=like property.value=%shape% orderby:path p.limit=-1
I want to find pages where the word shape appears more than once in the geometrixx pages.
I see 17 results, ordered by path. Every time one page appear more than once in the list of results, I can say that shape is here more than once.
So in this case, we have these pages:
It's of course not ideal.
Views
Replies
Total Likes
gcarlino wrote...
I will give you a specific example of what I'm trying to say. I'm doing this in a default installation, on a local instance, here: http://localhost:4502/libs/cq/search/content/querydebug.html
You enter this and click Search button:
path=/content/geometrixx
property=text
property.operation=like
property.value=%shape%
orderby:path
p.limit=-1
I want to find pages where the word shape appears more than once in the geometrixx pages.
I see 17 results, ordered by path. Every time one page appear more than once in the list of results, I can say that shape is here more than once.
So in this case, we have these pages:
http://localhost:4502/content/geometrixx/en/company.html
http://localhost:4502/content/geometrixx/en/services.html
http://localhost:4502/content/geometrixx/en/services/certification.html
http://localhost:4502/content/geometrixx/en/services/strategic.html
It's of course not ideal.
Thanks a lot for giving a best possible solution to implement the solution. It would be really great if you throw some light on how to segregate the 4 results from 17 results?
Thanks
Views
Replies
Total Likes
gcarlino wrote...
I will give you a specific example of what I'm trying to say. I'm doing this in a default installation, on a local instance, here: http://localhost:4502/libs/cq/search/content/querydebug.html
You enter this and click Search button:
path=/content/geometrixx
property=text
property.operation=like
property.value=%shape%
orderby:path
p.limit=-1
I want to find pages where the word shape appears more than once in the geometrixx pages.
I see 17 results, ordered by path. Every time one page appear more than once in the list of results, I can say that shape is here more than once.
So in this case, we have these pages:
http://localhost:4502/content/geometrixx/en/company.html
http://localhost:4502/content/geometrixx/en/services.html
http://localhost:4502/content/geometrixx/en/services/certification.html
http://localhost:4502/content/geometrixx/en/services/strategic.html
It's of course not ideal.
How to get only 4 results which we require. as per your example, How to segregate from 17 results?
Views
Replies
Total Likes
Actually I just realized that what I told you does not really help. I was just looking at some kind of workaround.
It only searches in components with text property, but for example not in title components. Plus it's case sensitive so it will find for example shape but not Shape.
So I tried this:
path=/content/geometrixx fulltext=*shape shape* type=cq:Page p.limit=-1
As you can see, it finds more results, and it shows pages, not components.
You could try this with your use case maybe.
Views
Replies
Total Likes
Here is the list of results i see (with comments inline):
You can see that the keyword is in 3 components of http://localhost:4502/content/geometrixx/en/company.html so this page is to keep.
All the pages above are not to keep because only one component has the keyword.
http://localhost:4502/content/geometrixx/en/services/certification.html is to keep too.
http://localhost:4502/content/geometrixx/en/services.html is to keep too.
http://localhost:4502/content/geometrixx/en/services/strategic.html is to keep too.
not to keep.
So really not ideal, as you can see. Plus it does not look at titles, since the property is jcr:title and not text. So you would have to compare this with:
path=/content/geometrixx property=jcr:title property.operation=like property.value=%shape% orderby:path p.limit=-1
An you would also have ideally to look for shape and Shape in both cases..
Views
Replies
Total Likes
Hi ,
thanks for your alternative thinking.
I had tried this before as my requirement is for a fulltext search only. But it doesnot meet my requirement as this search works only for one occurance of the search Keyword.
But I need only pages in the result which has the search keyword occur atleast more than once the page.
Any help in this regard is appreciated.
Thanks
Views
Replies
Total Likes
I understand that if more than one component has keyword than I need to choose the page. But my question is more on how? what is the code syntax to get only the page name from the URL and skip other URLS in the resultset?
Your help is really appreciated.
thanks
Views
Replies
Total Likes
I don't know how to do that. As Bsloki said, I doubt if you have that option in Querybuilder. I was just trying to help you with a workaround.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies