feat: enhanced filter
This commit is contained in:
parent
9eaab7d887
commit
78dc4cce44
|
|
@ -2,8 +2,9 @@
|
||||||
"latest": [
|
"latest": [
|
||||||
151, 53994, 54570, 54481, 54537, 54302, 53944, 55768, 55855, 56592, 54986,
|
151, 53994, 54570, 54481, 54537, 54302, 53944, 55768, 55855, 56592, 54986,
|
||||||
56875, 56873, 56666, 55996, 57407, 56249, 57858, 56973, 58600, 57399, 59737,
|
56875, 56873, 56666, 55996, 57407, 56249, 57858, 56973, 58600, 57399, 59737,
|
||||||
61688, 69750, 62764, 70101, 70194, 70191, 70146, 70190, 70189, 70188, 70187, 70186, 70182
|
61688, 69750, 62764, 70101, 70146, 70188
|
||||||
],
|
],
|
||||||
"comment": [54986],
|
"comment": [54986],
|
||||||
"comment_content": ["snowcherryblossom"]
|
"comment_content": ["snowcherryblossom"],
|
||||||
|
"post_content": ["R851UX3N", "BLBKKBVT", "biyijia"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,12 @@ export async function getFeed({
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const contentFilterQuery = filter.post_content
|
||||||
|
.map((content) => {
|
||||||
|
return `{ content: { path: "content", string_contains: "${content}" } }`
|
||||||
|
})
|
||||||
|
.join(",\n")
|
||||||
|
|
||||||
let resultAll: {
|
let resultAll: {
|
||||||
list: ExpandedNote[]
|
list: ExpandedNote[]
|
||||||
cursor?: string | null
|
cursor?: string | null
|
||||||
|
|
@ -127,7 +133,7 @@ export async function getFeed({
|
||||||
path: "tags",
|
path: "tags",
|
||||||
array_starts_with: "short" # TODO: remove this
|
array_starts_with: "short" # TODO: remove this
|
||||||
}
|
}
|
||||||
}]
|
}, ${contentFilterQuery}]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: [{ createdAt: desc }],
|
orderBy: [{ createdAt: desc }],
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ import {
|
||||||
} from "~/lib/types"
|
} from "~/lib/types"
|
||||||
import { client } from "~/queries/graphql"
|
import { client } from "~/queries/graphql"
|
||||||
|
|
||||||
|
import filter from "../../data/filter.json"
|
||||||
|
|
||||||
export const PINNED_PAGE_KEY = "xlog_pinned_page"
|
export const PINNED_PAGE_KEY = "xlog_pinned_page"
|
||||||
|
|
||||||
export async function checkPageSlug(input: {
|
export async function checkPageSlug(input: {
|
||||||
|
|
@ -175,6 +177,13 @@ export async function getPagesBySite(input: {
|
||||||
}`,
|
}`,
|
||||||
)
|
)
|
||||||
.join(", ")
|
.join(", ")
|
||||||
|
|
||||||
|
const contentFilterQuery = filter.post_content
|
||||||
|
.map((content) => {
|
||||||
|
return `{ content: { path: "content", string_contains: "${content}" } }`
|
||||||
|
})
|
||||||
|
.join(",\n")
|
||||||
|
|
||||||
const whereQuery = `
|
const whereQuery = `
|
||||||
{
|
{
|
||||||
characterId: {
|
characterId: {
|
||||||
|
|
@ -189,6 +198,7 @@ export async function getPagesBySite(input: {
|
||||||
equals: false,
|
equals: false,
|
||||||
},
|
},
|
||||||
metadata: {
|
metadata: {
|
||||||
|
NOT: [${contentFilterQuery}],
|
||||||
AND: [
|
AND: [
|
||||||
{
|
{
|
||||||
content: {
|
content: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue