Skip to content
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

WIP: Replace Meilisearch with Typesense #4403

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/pr-check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
cd sites/${{ matrix.site }}
npm ci

- name: Build search script
run: |
cd sites/${{ matrix.site }}
npm run build:search
# - name: Build search script
# run: |
# cd sites/${{ matrix.site }}
# npm run build:search

- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
Expand Down
12 changes: 0 additions & 12 deletions .platform/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
./build_docs.sh
deploy: |
cd $SITE_DIR
./deploy.sh
bash ./marker.sh "deployed" "${SITE_DIR}"
post_deploy:
cd $SITE_DIR && bash ./marker.sh "post_deploy" "${SITE_DIR}"
Expand Down Expand Up @@ -61,11 +60,6 @@
Content-Type: "text/plain; charset=UTF-8"
disk: 1024

mounts:
"sites/platform/public/scripts/xss/dist/config":
source: local
source_path: "sites/platform/config"

size: S

- # The name of this application, which must be unique within a project.
Expand Down Expand Up @@ -100,7 +94,6 @@
./build_docs.sh
deploy: |
cd $SITE_DIR
./deploy.sh
bash ./marker.sh "deployed" "${SITE_DIR}"
post_deploy:
cd $SITE_DIR && bash ./marker.sh "post_deploy" "${SITE_DIR}"
Expand Down Expand Up @@ -130,9 +123,4 @@

disk: 1024

mounts:
"sites/upsun/public/scripts/xss/dist/config":
source: local
source_path: "sites/upsun/config"

size: S
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ To ensure the docs work smoothly, a few checks run on each pull request:
npm install
# Generate necessary files
npm run dev
npm run build:search
# npm run build:search
# Build HTML pages to check
hugo
# Run the check
Expand Down
2 changes: 1 addition & 1 deletion build_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ clean_dir resources
cp ../../themes/psh-docs/postcss.config.js .
npm install
npm run build
npm run build:search
# npm run build:search
hugo

clear
Expand Down
288 changes: 144 additions & 144 deletions cypress/e2e/search.cy.js
Original file line number Diff line number Diff line change
@@ -1,144 +1,144 @@
//Both should return results for "opensearch"
//Only Upsun should return a match for "vertical scaling"
//Only platform should return a match for "24.55 gb"
describe("Searches",()=>{
beforeEach(()=>{
if('local' == Cypress.env('environment')) {
cy.intercept("/indexes/*_docs/search*", { "hits":[] })
}

//cy.visit("/")
})

context("Search tests",()=>{
it("Searches for something that should match in both", () => {
cy.visit("/")
if('local' == Cypress.env('environment')) {
cy.intercept({
pathname: '/indexes/*_docs/search',
query: {
q: 'opensearch'
}
},{ fixture: "opensearchresults" }).as("searchresultsopensearch")
}

cy.wait(1000)
cy.get("#searchwicon-header").type("opensearch")

if ('local' == Cypress.env('environment')) {
cy.wait('@searchresultsopensearch')
}

cy.get("#xssroot").find("h2").as("searchresultsheader")
cy.get("@searchresultsheader").should("exist")
cy.get("@searchresultsheader").contains("Documentation")
cy.get("#xssroot").find("li").contains("OpenSearch").should("exist")

cy.get("#searchwicon-header").type("{enter}")
cy.location("pathname").should(
"eq",
"/search.html"
)

cy.get("#xssSearchPage").find("h2").as("searchpageresults")
cy.get("@searchpageresults").should("exist")
cy.get("@searchpageresults").contains("Documentation")

cy.get("#xssSearchPage").find("li").contains("OpenSearch").should("exist")

})

it("Searches for something that should not match on Platformsh, but should on Upsun", ()=>{
const searchDetails = {
search: 'vertical scaling',
header: 'No results',
body: 'No documentation matched'
}

if ('upsun' == Cypress.env('site')) {
searchDetails.header = 'Documentation'
searchDetails.body = searchDetails.search
}

cy.visit("/")
cy.wait(1000)
cy.get("#searchwicon-header").type(searchDetails.search)
cy.get("#xssroot").find("h2").as("searchresultsheader")
cy.get("@searchresultsheader").should("exist")
cy.get("@searchresultsheader").contains(searchDetails.header)
cy.get("#xssroot").find("p").contains(searchDetails.body)

cy.get("#searchwicon-header").type("{enter}")
cy.location("pathname").should(
"eq",
"/search.html"
)

cy.get("#xssSearchPage").find("h2").as("searchpageresults")
cy.get("@searchpageresults").should("exist")
if ('upsun' == Cypress.env('site')) {
cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
} else {
cy.get("#xssSearchPage").contains(searchDetails.header)
}

})

it("Searches for something that should ONLY match on platformsh, but not on Upsun", () => {
const searchDetails = {
search: 'DG3',
header: 'No results',
body: 'No documentation matched'
}

console.log('Current site is ' + Cypress.env('site'))

if ('platformsh' == Cypress.env('site')) {
searchDetails.header = 'Documentation'
searchDetails.body = searchDetails.search
}

cy.visit("/")
if('local' == Cypress.env('environment')) {
cy.intercept({
pathname: '/indexes/*_docs/search',
query: {
q: 'opensearch'
}
},{ fixture: "searchosresults" }).as("searchresultsopensearch")
}

//console.log('Pausing before starting')
cy.wait(1000)
//console.log('finished pausing')

cy.get("#searchwicon-header").clear().type(searchDetails.search)

if ('local' == Cypress.env('environment')) {
cy.wait('@searchresultsopensearch')
}

cy.get("#xssroot").find("h2").as("searchresultsheader")
cy.get("@searchresultsheader").should("exist")
cy.get("@searchresultsheader").contains(searchDetails.header)
cy.get('#xssroot').find('p').contains(searchDetails.body)

cy.get("#searchwicon-header").type("{enter}")
cy.location("pathname").should(
"eq",
"/search.html"
)

cy.get("#xssSearchPage").find("h2").as("searchpageresults")
cy.get("@searchpageresults").should("exist")
cy.get("@searchpageresults").contains(searchDetails.header)

if ('platformsh' == Cypress.env('site')) {
cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
} else {
cy.get("#xssSearchPage").contains(searchDetails.body)
}

})
})
})
// //Both should return results for "opensearch"
// //Only Upsun should return a match for "vertical scaling"
// //Only platform should return a match for "24.55 gb"
// describe("Searches",()=>{
// beforeEach(()=>{
// if('local' == Cypress.env('environment')) {
// cy.intercept("/indexes/*_docs/search*", { "hits":[] })
// }

// //cy.visit("/")
// })

// context("Search tests",()=>{
// it("Searches for something that should match in both", () => {
// cy.visit("/")
// if('local' == Cypress.env('environment')) {
// cy.intercept({
// pathname: '/indexes/*_docs/search',
// query: {
// q: 'opensearch'
// }
// },{ fixture: "opensearchresults" }).as("searchresultsopensearch")
// }

// cy.wait(1000)
// cy.get("#searchwicon-header").type("opensearch")

// if ('local' == Cypress.env('environment')) {
// cy.wait('@searchresultsopensearch')
// }

// cy.get("#xssroot").find("h2").as("searchresultsheader")
// cy.get("@searchresultsheader").should("exist")
// cy.get("@searchresultsheader").contains("Documentation")
// cy.get("#xssroot").find("li").contains("OpenSearch").should("exist")

// cy.get("#searchwicon-header").type("{enter}")
// cy.location("pathname").should(
// "eq",
// "/search.html"
// )

// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
// cy.get("@searchpageresults").should("exist")
// cy.get("@searchpageresults").contains("Documentation")

// cy.get("#xssSearchPage").find("li").contains("OpenSearch").should("exist")

// })

// it("Searches for something that should not match on Platformsh, but should on Upsun", ()=>{
// const searchDetails = {
// search: 'vertical scaling',
// header: 'No results',
// body: 'No documentation matched'
// }

// if ('upsun' == Cypress.env('site')) {
// searchDetails.header = 'Documentation'
// searchDetails.body = searchDetails.search
// }

// cy.visit("/")
// cy.wait(1000)
// cy.get("#searchwicon-header").type(searchDetails.search)
// cy.get("#xssroot").find("h2").as("searchresultsheader")
// cy.get("@searchresultsheader").should("exist")
// cy.get("@searchresultsheader").contains(searchDetails.header)
// cy.get("#xssroot").find("p").contains(searchDetails.body)

// cy.get("#searchwicon-header").type("{enter}")
// cy.location("pathname").should(
// "eq",
// "/search.html"
// )

// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
// cy.get("@searchpageresults").should("exist")
// if ('upsun' == Cypress.env('site')) {
// cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
// } else {
// cy.get("#xssSearchPage").contains(searchDetails.header)
// }

// })

// it("Searches for something that should ONLY match on platformsh, but not on Upsun", () => {
// const searchDetails = {
// search: '24.55',
// header: 'No results',
// body: 'No documentation matched'
// }

// console.log('Current site is ' + Cypress.env('site'))

// if ('platformsh' == Cypress.env('site')) {
// searchDetails.header = 'Documentation'
// searchDetails.body = searchDetails.search
// }

// cy.visit("/")
// if('local' == Cypress.env('environment')) {
// cy.intercept({
// pathname: '/indexes/*_docs/search',
// query: {
// q: 'opensearch'
// }
// },{ fixture: "searchosresults" }).as("searchresultsopensearch")
// }

// //console.log('Pausing before starting')
// cy.wait(1000)
// //console.log('finished pausing')

// cy.get("#searchwicon-header").clear().type(searchDetails.search)

// if ('local' == Cypress.env('environment')) {
// cy.wait('@searchresultsopensearch')
// }

// cy.get("#xssroot").find("h2").as("searchresultsheader")
// cy.get("@searchresultsheader").should("exist")
// cy.get("@searchresultsheader").contains(searchDetails.header)
// cy.get('#xssroot').find('p').contains(searchDetails.body)

// cy.get("#searchwicon-header").type("{enter}")
// cy.location("pathname").should(
// "eq",
// "/search.html"
// )

// cy.get("#xssSearchPage").find("h2").as("searchpageresults")
// cy.get("@searchpageresults").should("exist")
// cy.get("@searchpageresults").contains(searchDetails.header)

// if ('platformsh' == Cypress.env('site')) {
// cy.get("#xssSearchPage").find("li").contains(searchDetails.body).should("exist")
// } else {
// cy.get("#xssSearchPage").contains(searchDetails.body)
// }

// })
// })
// })
2 changes: 1 addition & 1 deletion sites/platform/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -e

# Build Interface app for search/autocomplete
npm run build:search
# npm run build:search

# Copy templates index so it will be served for search to grab
mkdir static/files/indexes && cp ../../shared/data/templates.yaml static/files/indexes/templates.yaml
Expand Down
Loading
Loading