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

chore: better filtering of test search queries for more accurate data #3752

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set check_function_bodies = off;

CREATE OR REPLACE FUNCTION public.match_weekly_search_usage()
RETURNS TABLE(query_string character varying, count bigint)
LANGUAGE plpgsql
AS $function$
begin
return query
SELECT
queries.query_string,
count(*) as count
FROM
queries
WHERE
type = 'docs-search'
AND queries.query_string != 'dsys'
AND queries.query_string != 'this is a search test'
AND queries.created_at >= now() - interval '1 week'
GROUP BY
queries.query_string
ORDER BY
count DESC
LIMIT 20;
end;
$function$
;


2 changes: 1 addition & 1 deletion cypress/integration/api/discussions-search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context("GET /api/discussions-search", () => {
it("gets a list of discussions", () => {
cy.request("POST", "/api/discussions-search", { prompt: "creating a button" }).then((response) => {
cy.request("POST", "/api/discussions-search", { prompt: "this is a search test" }).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.data).length.to.be.greaterThan(1);
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/api/docs-search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
context("GET /api/docs-search", () => {
it("gets a list of docs", () => {
cy.request("POST", "/api/docs-search", { prompt: "creating a button" }).then((response) => {
cy.request("POST", "/api/docs-search", { prompt: "this is a search test" }).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.data).length.to.be.greaterThan(1);
});
Expand Down
10 changes: 6 additions & 4 deletions cypress/integration/api/paste-assistant-message.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ context("POST /api/paste-assistant-message", () => {

it("creates an message on an ai thread", () => {
// create a message on the thread
cy.request("POST", "/api/paste-assistant-message", { threadId, message: "create a button" }).then((response) => {
expect(response.status).to.eq(200);
});
cy.request("POST", "/api/paste-assistant-message", { threadId, message: "this is a search test" }).then(
(response) => {
expect(response.status).to.eq(200);
},
);
});

it("gets messages on an ai thread", () => {
// get messages on the thread
cy.request("GET", `/api/paste-assistant-messages/${threadId}`).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.data).length.to.be.greaterThan(0);
expect(response.body.data[0].content[0].text.value).to.eq("create a button");
expect(response.body.data[0].content[0].text.value).to.eq("this is a search test");
});
});
});
2 changes: 1 addition & 1 deletion cypress/integration/site-search/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Docs website search", () => {
cy.get('[data-cy="paste-docsearch-input"]')
.should("be.visible")
.should("be.focused")
.type("checkbox")
.type("this is a search test")
.type("{enter}");
cy.wait("@searchRequest");
cy.get('[data-cy="paste-docsearch-hits"] h2').should("have.length.above", 0);
Expand Down
Loading