-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue 210 - Implementing search functionality #216
Conversation
Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
|
|
1 similar comment
|
|
|
|
const res = document.createElement('div'); | ||
res.classList.add('search-result'); | ||
const header = document.createElement('h3'); | ||
const link = document.createElement('a'); | ||
const searchTitle = line.pagename || line.breadcrumbtitle || line.title; | ||
if (line.pagename === 'Newsroom') searchTitle = line.breadcrumbtitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a type
field which you can use to know whether its a "Newsroom" or "Health Thinking" page.
@@ -85,7 +87,7 @@ async function searchPages(placeholders, term, page) { | |||
let childSpan; | |||
|
|||
if (parentPath) { | |||
if (line.path.indexOf('/news/') !== -1) { | |||
if (line.path.indexOf('/newsroom/') !== -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as prior comment to determine the type
.
|
@@ -72,11 +72,14 @@ async function searchPages(placeholders, term, page) { | |||
const curPage = result.slice(startResult, startResult + resultsPerPage); | |||
|
|||
curPage.forEach((line) => { | |||
console.log(line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -72,11 +72,14 @@ async function searchPages(placeholders, term, page) { | |||
const curPage = result.slice(startResult, startResult + resultsPerPage); | |||
|
|||
curPage.forEach((line) => { | |||
console.log(line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -85,7 +88,7 @@ async function searchPages(placeholders, term, page) { | |||
let childSpan; | |||
|
|||
if (parentPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was mainly for the sunstar engineering search results.
is the same applicable on sunstar also and if not we can remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, looking at the search results, its applicable here as well.
const res = document.createElement('div'); | ||
res.classList.add('search-result'); | ||
const header = document.createElement('h3'); | ||
const link = document.createElement('a'); | ||
const searchTitle = line.pagename || line.breadcrumbtitle || line.title; | ||
if (line.type === 'Newsroom') searchTitle = line.breadcrumbtitle || line.title || line.type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't get this change, why we need to make this special check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jindaliiita - we need this since for newsroom type, there are certain things that needs to be populated in the search. That's why. There were couple of instances where line.breadcrumbtitle was empty and hence there was nothing coming up to click. That's why we put line.breadcrumbtitle || line.title || line.type.
|
|
…was actually creating conflict
|
|
|
|
|
|
|
|
|
|
🔸 26 visual differences detected
The diff images are attached in the artifact |
🔸 26 visual differences detected
The diff images are attached in the artifact |
|
🔸 26 visual differences detected
The diff images are attached in the artifact |
|
|
🔸 27 visual differences detected
The diff images are attached in the artifact |
const res1h3a = res1h3.children[0]; | ||
expect(res1h3a.nodeName).to.equal('A'); | ||
expect(res1h3a.href.endsWith('/news/a/')).to.be.true; | ||
expect(res1h3.nodeName).to.equal('P'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the tests prior to the change tested the result content and ordering as well which we are not doing now. Would it help if the test fixtures are updated and we retain these checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, Will check with David on that - how these tests are working.
// elementForward = currentElement.nextElementSibling.nextElementSibling; | ||
// } | ||
// eslint-disable-next-line max-len | ||
elementForward = (page === 0) ? currentElement.nextElementSibling.nextElementSibling.nextElementSibling : currentElement.nextElementSibling.nextElementSibling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be problematic if there are lesser number of siblings than this code expects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nopes, it will not be, since these are under the condition if if (totalPages > paginationLimit) . Here Pagination Limit is 5. If totalPages is more than 5 then only, rest of the logic will apply. Please advise.
if (elementForward.innerText === '...') break; | ||
} | ||
// eslint-disable-next-line max-len | ||
let elementBefore = currentElement.previousElementSibling.previousElementSibling.previousElementSibling; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be problematic if there are lesser number of siblings than this code expects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nopes, it will not be, since these are under the condition if if (totalPages > paginationLimit) . Here Pagination Limit is 5. If totalPages is more than 5 then only, rest of the logic will apply. Please advise.
|
🔸 27 visual differences detected
The diff images are attached in the artifact |
Please always provide the GitHub issue(s) your PR is for, as well as test URLs where your change can be observed (before and after):
Fixes #210
Test URLs:
Original: https://www.sunstar.com/search/san+francisco?nonce=1c6e597917
Before: https://main--sunstar--hlxsites.hlx.page/search?s=san+francisco
After: https://issue210-search-functionality--sunstar--hlxsites.hlx.page/search?s=san+francisco
If you are adding a new block or a variation to an existing block, please fill below:
Block library path: https://--sunstar--hlxsites.hlx.page/tools/sidekick/library.html?plugin=blocks&path=/sidekick/blocks/&index=0