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

remove deprecated search 'term' (use 'q') #2507

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions .changeset/tidy-shoes-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@atproto/bsky": patch
"@atproto/api": patch
"@atproto/pds": patch
---

remove deprecated search 'term' param
4 changes: 0 additions & 4 deletions lexicons/app/bsky/actor/searchActors.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
"parameters": {
"type": "params",
"properties": {
"term": {
"type": "string",
"description": "DEPRECATED: use 'q' instead."
},
"q": {
"type": "string",
"description": "Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
Expand Down
4 changes: 0 additions & 4 deletions lexicons/app/bsky/actor/searchActorsTypeahead.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
"parameters": {
"type": "params",
"properties": {
"term": {
"type": "string",
"description": "DEPRECATED: use 'q' instead."
},
"q": {
"type": "string",
"description": "Search query prefix; not a full query string."
Expand Down
4 changes: 0 additions & 4 deletions lexicons/tools/ozone/moderation/searchRepos.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
"parameters": {
"type": "params",
"properties": {
"term": {
"type": "string",
"description": "DEPRECATED: use 'q' instead"
},
"q": { "type": "string" },
"limit": {
"type": "integer",
Expand Down
12 changes: 0 additions & 12 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4308,10 +4308,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description:
Expand Down Expand Up @@ -4361,10 +4357,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description: 'Search query prefix; not a full query string.',
Expand Down Expand Up @@ -10491,10 +10483,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead",
},
q: {
type: 'string',
},
Expand Down
2 changes: 0 additions & 2 deletions packages/api/src/client/types/app/bsky/actor/searchActors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { CID } from 'multiformats/cid'
import * as AppBskyActorDefs from './defs'

export interface QueryParams {
/** DEPRECATED: use 'q' instead. */
term?: string
/** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
q?: string
limit?: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { CID } from 'multiformats/cid'
import * as AppBskyActorDefs from './defs'

export interface QueryParams {
/** DEPRECATED: use 'q' instead. */
term?: string
/** Search query prefix; not a full query string. */
q?: string
limit?: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { CID } from 'multiformats/cid'
import * as ToolsOzoneModerationDefs from './defs'

export interface QueryParams {
/** DEPRECATED: use 'q' instead */
term?: string
q?: string
limit?: number
cursor?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/src/api/app/bsky/actor/searchActors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function (server: Server, ctx: AppContext) {

const skeleton = async (inputs: SkeletonFnInput<Context, Params>) => {
const { ctx, params } = inputs
const term = params.q ?? params.term ?? ''
const term = params.q ?? ''

// @TODO
// add hits total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function (server: Server, ctx: AppContext) {

const skeleton = async (inputs: SkeletonFnInput<Context, Params>) => {
const { ctx, params } = inputs
const term = params.q ?? params.term ?? ''
const term = params.q ?? ''

// @TODO
// add typeahead option
Expand Down
8 changes: 0 additions & 8 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4308,10 +4308,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description:
Expand Down Expand Up @@ -4361,10 +4357,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description: 'Search query prefix; not a full query string.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
import * as AppBskyActorDefs from './defs'

export interface QueryParams {
/** DEPRECATED: use 'q' instead. */
term?: string
/** Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
q?: string
limit: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
import * as AppBskyActorDefs from './defs'

export interface QueryParams {
/** DEPRECATED: use 'q' instead. */
term?: string
/** Search query prefix; not a full query string. */
q?: string
limit: number
Expand Down
32 changes: 16 additions & 16 deletions packages/bsky/tests/views/actor-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe.skip('pds actor search views', () => {

it('typeahead gives relevant results', async () => {
const result = await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: 'car' },
{ q: 'car' },
{ headers },
)

Expand Down Expand Up @@ -85,9 +85,9 @@ describe.skip('pds actor search views', () => {
expect(forSnapshot(sorted)).toMatchSnapshot()
})

it('typeahead gives empty result set when provided empty term', async () => {
it('typeahead gives empty result set when provided empty q', async () => {
const result = await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: '' },
{ q: '' },
{ headers },
)

Expand All @@ -96,14 +96,14 @@ describe.skip('pds actor search views', () => {

it('typeahead applies limit', async () => {
const full = await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: 'p' },
{ q: 'p' },
{ headers },
)

expect(full.data.actors.length).toBeGreaterThan(5)

const limited = await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: 'p', limit: 5 },
{ q: 'p', limit: 5 },
{ headers },
)

Expand All @@ -125,20 +125,20 @@ describe.skip('pds actor search views', () => {
it('typeahead gives results unauthed', async () => {
const { data: authed } =
await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: 'car' },
{ q: 'car' },
{ headers },
)
const { data: unauthed } =
await agent.api.app.bsky.actor.searchActorsTypeahead({
term: 'car',
q: 'car',
})
expect(unauthed.actors.length).toBeGreaterThan(0)
expect(unauthed.actors).toEqual(authed.actors.map(stripViewer))
})

it('search gives relevant results', async () => {
const result = await agent.api.app.bsky.actor.searchActors(
{ term: 'car' },
{ q: 'car' },
{ headers },
)

Expand Down Expand Up @@ -174,9 +174,9 @@ describe.skip('pds actor search views', () => {
expect(forSnapshot(sorted)).toMatchSnapshot()
})

it('search gives empty result set when provided empty term', async () => {
it('search gives empty result set when provided empty q', async () => {
const result = await agent.api.app.bsky.actor.searchActors(
{ term: '' },
{ q: '' },
{ headers },
)

Expand All @@ -187,7 +187,7 @@ describe.skip('pds actor search views', () => {
const results = (results) => results.flatMap((res) => res.users)
const paginator = async (cursor?: string) => {
const res = await agent.api.app.bsky.actor.searchActors(
{ term: 'p', cursor, limit: 3 },
{ q: 'p', cursor, limit: 3 },
{ headers },
)
return res.data
Expand All @@ -199,7 +199,7 @@ describe.skip('pds actor search views', () => {
)

const full = await agent.api.app.bsky.actor.searchActors(
{ term: 'p' },
{ q: 'p' },
{ headers },
)

Expand All @@ -217,7 +217,7 @@ describe.skip('pds actor search views', () => {
// Mostly for sqlite's benefit, since it uses LIKE and these are special characters that will
// get stripped. This input triggers a special case where there are no "safe" words for sqlite to search on.
const result = await agent.api.app.bsky.actor.searchActors(
{ term: ' % _ ' },
{ q: ' % _ ' },
{ headers },
)

Expand All @@ -226,11 +226,11 @@ describe.skip('pds actor search views', () => {

it('search gives results unauthed', async () => {
const { data: authed } = await agent.api.app.bsky.actor.searchActors(
{ term: 'car' },
{ q: 'car' },
{ headers },
)
const { data: unauthed } = await agent.api.app.bsky.actor.searchActors({
term: 'car',
q: 'car',
})
expect(unauthed.actors.length).toBeGreaterThan(0)
expect(unauthed.actors).toEqual(authed.actors.map(stripViewer))
Expand All @@ -241,7 +241,7 @@ describe.skip('pds actor search views', () => {
did: sc.dids['cara-wiegand69.test'],
})
const result = await agent.api.app.bsky.actor.searchActorsTypeahead(
{ term: 'car' },
{ q: 'car' },
{ headers },
)
const handles = result.data.actors.map((u) => u.handle)
Expand Down
8 changes: 4 additions & 4 deletions packages/bsky/tests/views/block-lists.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ describe('pds views with blocking from block lists', () => {
it('does not return blocked accounts in actor search', async () => {
const resCarol = await agent.api.app.bsky.actor.searchActors(
{
term: 'dan.test',
q: 'dan.test',
},
{ headers: await network.serviceHeaders(carol) },
)
expect(resCarol.data.actors.some((actor) => actor.did === dan)).toBeFalsy()

const resDan = await agent.api.app.bsky.actor.searchActors(
{
term: 'carol.test',
q: 'carol.test',
},
{ headers: await network.serviceHeaders(dan) },
)
Expand All @@ -295,15 +295,15 @@ describe('pds views with blocking from block lists', () => {
it('does not return blocked accounts in actor search typeahead', async () => {
const resCarol = await agent.api.app.bsky.actor.searchActorsTypeahead(
{
term: 'dan.test',
q: 'dan.test',
},
{ headers: await network.serviceHeaders(carol) },
)
expect(resCarol.data.actors.some((actor) => actor.did === dan)).toBeFalsy()

const resDan = await agent.api.app.bsky.actor.searchActorsTypeahead(
{
term: 'carol.test',
q: 'carol.test',
},
{ headers: await network.serviceHeaders(dan) },
)
Expand Down
8 changes: 4 additions & 4 deletions packages/bsky/tests/views/blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,15 @@ describe('pds views with blocking', () => {
it('does not return blocked accounts in actor search', async () => {
const resCarol = await agent.api.app.bsky.actor.searchActors(
{
term: 'dan.test',
q: 'dan.test',
},
{ headers: await network.serviceHeaders(carol) },
)
expect(resCarol.data.actors.some((actor) => actor.did === dan)).toBeFalsy()

const resDan = await agent.api.app.bsky.actor.searchActors(
{
term: 'carol.test',
q: 'carol.test',
},
{ headers: await network.serviceHeaders(dan) },
)
Expand All @@ -365,15 +365,15 @@ describe('pds views with blocking', () => {
it('does not return blocked accounts in actor search typeahead', async () => {
const resCarol = await agent.api.app.bsky.actor.searchActorsTypeahead(
{
term: 'dan.test',
q: 'dan.test',
},
{ headers: await network.serviceHeaders(carol) },
)
expect(resCarol.data.actors.some((actor) => actor.did === dan)).toBeFalsy()

const resDan = await agent.api.app.bsky.actor.searchActorsTypeahead(
{
term: 'carol.test',
q: 'carol.test',
},
{ headers: await network.serviceHeaders(dan) },
)
Expand Down
4 changes: 1 addition & 3 deletions packages/ozone/src/api/moderation/searchRepos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export default function (server: Server, ctx: AppContext) {
auth: ctx.authVerifier.modOrAdminToken,
handler: async ({ params }) => {
const modService = ctx.modService(ctx.db)

// prefer new 'q' query param over deprecated 'term'
const query = params.q ?? params.term
const query = params.q ?? ''

// special case for did searches - do exact match
if (query?.startsWith('did:')) {
Expand Down
12 changes: 0 additions & 12 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4308,10 +4308,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description:
Expand Down Expand Up @@ -4361,10 +4357,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead.",
},
q: {
type: 'string',
description: 'Search query prefix; not a full query string.',
Expand Down Expand Up @@ -10491,10 +10483,6 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
term: {
type: 'string',
description: "DEPRECATED: use 'q' instead",
},
q: {
type: 'string',
},
Expand Down
Loading
Loading