web search done right
rename all 'type' to '_type' in api as 'type' might be reserved in some languages also optionally return structured data from api
Mikkel Denker84f56053a1b0
diff --git a/crates/core/src/api/docs.rs b/crates/core/src/api/docs.rsindex c1ab28a9..f8ebd65a 100644--- a/crates/core/src/api/docs.rs+++ b/crates/core/src/api/docs.rs@@ -93,6 +93,11 @@ use utoipa_swagger_ui::SwaggerUi;crate::webgraph::Node,crate::webgraph::FullEdge,++ crate::search_prettifier::StructuredData,+ crate::search_prettifier::OneOrManyString,+ crate::search_prettifier::OneOrManyProperty,+ crate::search_prettifier::Property,),),modifiers(&ApiModifier),diff --git a/crates/core/src/api/search.rs b/crates/core/src/api/search.rsindex 94551bea..8a2b1180 100644--- a/crates/core/src/api/search.rs+++ b/crates/core/src/api/search.rs@@ -43,7 +43,7 @@ use axum::{extract, response::IntoResponse};bincode::Decode,ToSchema,)]-#[serde(tag = "type", content = "value", rename_all = "camelCase")]+#[serde(tag = "_type", content = "value", rename_all = "camelCase")]pub enum ReturnBody {All,Truncated(usize),@@ -72,6 +72,9 @@ pub struct ApiSearchQuery {#[serde(default = "defaults::SearchQuery::count_results")]pub count_results: bool,+ #[serde(default = "defaults::SearchQuery::return_structured_data")]+ pub return_structured_data: bool,+pub return_body: Option<ReturnBody>,}@@ -98,6 +101,7 @@ impl TryFrom<ApiSearchQuery> for SearchQuery {safe_search: api.safe_search.unwrap_or(default.safe_search),count_results: api.count_results,return_body: api.return_body,+ return_structured_data: api.return_structured_data,})}}@@ -105,7 +109,7 @@ impl TryFrom<ApiSearchQuery> for SearchQuery {#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,)]-#[serde(tag = "type", rename_all = "camelCase")]+#[serde(tag = "_type", rename_all = "camelCase")]pub enum ApiSearchResult {Websites(WebsitesResult),Bang(Box<BangHit>),diff --git a/crates/core/src/api/webgraph.rs b/crates/core/src/api/webgraph.rsindex 94eaed07..b6c03a4b 100644--- a/crates/core/src/api/webgraph.rs+++ b/crates/core/src/api/webgraph.rs@@ -236,7 +236,7 @@ async fn outgoing_links(}#[derive(serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema)]-#[serde(tag = "type", rename_all = "camelCase")]+#[serde(tag = "_type", rename_all = "camelCase")]pub enum KnowsHost {Known { host: String },Unknown,diff --git a/crates/core/src/config/defaults.rs b/crates/core/src/config/defaults.rsindex 982d747a..ed4d9824 100644--- a/crates/core/src/config/defaults.rs+++ b/crates/core/src/config/defaults.rs@@ -144,6 +144,10 @@ impl SearchQuery {pub fn count_results() -> bool {false}++ pub fn return_structured_data() -> bool {+ false+ }}pub struct Correction;diff --git a/crates/core/src/config/mod.rs b/crates/core/src/config/mod.rsindex d2de173b..c5ff1a33 100644--- a/crates/core/src/config/mod.rs+++ b/crates/core/src/config/mod.rs@@ -49,7 +49,7 @@ pub struct IndexingLocalConfig {}#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)]-#[serde(tag = "type")]+#[serde(tag = "_type")]pub enum IndexingGraphConfig {Local { path: String },Remote { gossip: GossipConfig },@@ -77,7 +77,7 @@ pub struct WebgraphConstructConfig {}#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, Clone)]-#[serde(tag = "type")]+#[serde(tag = "_type")]pub enum WarcSource {HTTP(HttpConfig),Local(LocalConfig),@@ -382,7 +382,7 @@ pub struct CrawlRouterConfig {}#[derive(Debug, serde::Serialize, serde::Deserialize, Clone)]-#[serde(tag = "type", content = "args", rename_all = "snake_case")]+#[serde(tag = "_type", content = "args", rename_all = "snake_case")]pub enum AcceleratorDevice {Cpu,Cuda(usize),diff --git a/crates/core/src/search_prettifier/mod.rs b/crates/core/src/search_prettifier/mod.rsindex 1488431f..a3a9826a 100644--- a/crates/core/src/search_prettifier/mod.rs+++ b/crates/core/src/search_prettifier/mod.rs@@ -1,5 +1,5 @@// Stract is an open source web search engine.-// Copyright (C) 2023 Stract ApS+// Copyright (C) 2024 Stract ApS//// This program is free software: you can redistribute it and/or modify// it under the terms of the GNU Affero General Public License as@@ -15,6 +15,7 @@// along with this program. If not, see <https://www.gnu.org/licenses/>.mod entity;+mod schema_org;mod stack_overflow;use std::collections::HashMap;@@ -37,6 +38,7 @@ use crate::{pub use self::stack_overflow::{create_stackoverflow_sidebar, CodeOrText};pub use entity::DisplayedEntity;+pub use schema_org::{OneOrManyProperty, OneOrManyString, Property, StructuredData};pub use self::stack_overflow::{stackoverflow_snippet, StackOverflowAnswer, StackOverflowQuestion};@@ -52,7 +54,7 @@ pub struct Snippet {#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, Clone, ToSchema,)]-#[serde(tag = "type", rename_all = "camelCase")]+#[serde(tag = "_type", rename_all = "camelCase")]pub enum RichSnippet {StackOverflowQA {question: StackOverflowQuestion,@@ -191,6 +193,7 @@ pub struct DisplayedWebpage {pub body: Option<String>,pub rich_snippet: Option<RichSnippet>,pub ranking_signals: Option<HashMap<SignalEnumDiscriminants, SignalScore>>,+ pub structured_data: Option<Vec<StructuredData>>,pub score: Option<f64>,pub likely_has_ads: bool,pub likely_has_paywall: bool,@@ -222,6 +225,18 @@ impl DisplayedWebpage {ReturnBody::Truncated(n) => webpage.body.chars().take(n).collect::<String>(),});+ let structured_data = if query.return_structured_data {+ Some(+ webpage+ .schema_org+ .into_iter()+ .map(StructuredData::from)+ .collect(),+ )+ } else {+ None+ };+Self {title: webpage.title,site: url.normalized_host().unwrap_or_default().to_string(),@@ -235,6 +250,7 @@ impl DisplayedWebpage {likely_has_ads: webpage.likely_has_ads,likely_has_paywall: webpage.likely_has_paywall,rich_snippet,+ structured_data,}}}@@ -242,7 +258,7 @@ impl DisplayedWebpage {#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, Clone, ToSchema,)]-#[serde(tag = "type", content = "value", rename_all = "camelCase")]+#[serde(tag = "_type", content = "value", rename_all = "camelCase")]pub enum DisplayedSidebar {Entity(DisplayedEntity),StackOverflow {diff --git a/crates/core/src/search_prettifier/schema_org.rs b/crates/core/src/search_prettifier/schema_org.rsnew file mode 100644index 00000000..e7787a88--- /dev/null+++ b/crates/core/src/search_prettifier/schema_org.rs@@ -0,0 +1,102 @@+// Stract is an open source web search engine.+// Copyright (C) 2024 Stract ApS+//+// This program is free software: you can redistribute it and/or modify+// it under the terms of the GNU Affero General Public License as+// published by the Free Software Foundation, either version 3 of the+// License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU Affero General Public License for more details.+//+// You should have received a copy of the GNU Affero General Public License+// along with this program. If not, see <https://www.gnu.org/licenses/>.++//! This module is a hacky workaround for the fact that the `openapi` does not+//! like generics very much.++use std::collections::HashMap;++use utoipa::ToSchema;++#[derive(+ Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,+)]+#[serde(untagged, rename_all = "camelCase")]+pub enum OneOrManyString {+ One(String),+ Many(Vec<String>),+}++impl From<crate::OneOrMany<String>> for OneOrManyString {+ fn from(one_or_many: crate::OneOrMany<String>) -> Self {+ match one_or_many {+ crate::OneOrMany::One(one) => OneOrManyString::One(one),+ crate::OneOrMany::Many(many) => OneOrManyString::Many(many),+ }+ }+}++#[derive(+ Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,+)]+#[serde(untagged, rename_all = "camelCase")]+pub enum Property {+ String(String),+ Data(StructuredData),+}++impl From<crate::webpage::schema_org::Property> for Property {+ fn from(property: crate::webpage::schema_org::Property) -> Self {+ match property {+ crate::webpage::schema_org::Property::String(string) => Property::String(string),+ crate::webpage::schema_org::Property::Item(data) => Property::Data(data.into()),+ }+ }+}++#[derive(+ Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,+)]+#[serde(untagged, rename_all = "camelCase")]+pub enum OneOrManyProperty {+ One(Property),+ Many(Vec<Property>),+}++impl From<crate::OneOrMany<crate::webpage::schema_org::Property>> for OneOrManyProperty {+ fn from(one_or_many: crate::OneOrMany<crate::webpage::schema_org::Property>) -> Self {+ match one_or_many {+ crate::OneOrMany::One(one) => OneOrManyProperty::One(one.into()),+ crate::OneOrMany::Many(many) => {+ OneOrManyProperty::Many(many.into_iter().map(Into::into).collect())+ }+ }+ }+}++#[derive(+ Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,+)]+#[serde(rename_all = "camelCase")]+pub struct StructuredData {+ #[serde(rename = "_type")]+ pub item_type: Option<OneOrManyString>,+ #[serde(flatten)]+ pub properties: HashMap<String, OneOrManyProperty>,+}++impl From<crate::webpage::schema_org::Item> for StructuredData {+ fn from(item: crate::webpage::schema_org::Item) -> Self {+ Self {+ item_type: item.itemtype.map(OneOrManyString::from),+ properties: item+ .properties+ .into_iter()+ .map(|(k, v)| (k, v.into()))+ .collect(),+ }+ }+}diff --git a/crates/core/src/search_prettifier/stack_overflow.rs b/crates/core/src/search_prettifier/stack_overflow.rsindex 0d8c58c0..68335ace 100644--- a/crates/core/src/search_prettifier/stack_overflow.rs+++ b/crates/core/src/search_prettifier/stack_overflow.rs@@ -49,7 +49,7 @@ pub struct StackOverflowQuestion {#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, Clone, ToSchema,)]-#[serde(tag = "type", content = "value", rename_all = "camelCase")]+#[serde(tag = "_type", content = "value", rename_all = "camelCase")]pub enum CodeOrText {Code(String),Text(String),diff --git a/crates/core/src/searcher/mod.rs b/crates/core/src/searcher/mod.rsindex aec003cf..47b96c51 100644--- a/crates/core/src/searcher/mod.rs+++ b/crates/core/src/searcher/mod.rs@@ -76,6 +76,7 @@ pub struct SearchQuery {pub safe_search: bool,pub count_results: bool,pub return_body: Option<ReturnBody>,+ pub return_structured_data: bool,}#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode)]@@ -101,6 +102,7 @@ impl Default for SearchQuery {safe_search: defaults::SearchQuery::safe_search(),count_results: defaults::SearchQuery::count_results(),return_body: None,+ return_structured_data: defaults::SearchQuery::return_structured_data(),}}}diff --git a/crates/core/src/widgets/mod.rs b/crates/core/src/widgets/mod.rsindex 337319c3..11a10405 100644--- a/crates/core/src/widgets/mod.rs+++ b/crates/core/src/widgets/mod.rs@@ -83,7 +83,7 @@ impl Widgets {#[derive(Debug, serde::Serialize, serde::Deserialize, bincode::Encode, bincode::Decode, ToSchema,)]-#[serde(tag = "type", content = "value", rename_all = "camelCase")]+#[serde(tag = "_type", content = "value", rename_all = "camelCase")]pub enum Widget {Calculator(Calculation),Thesaurus(ThesaurusWidget),diff --git a/frontend/src/lib/api/index.ts b/frontend/src/lib/api/index.tsindex 1f69ed37..c37e22fe 100644--- a/frontend/src/lib/api/index.ts+++ b/frontend/src/lib/api/index.ts@@ -198,15 +198,16 @@ export type ApiSearchQuery = {query: string;returnBody?: ReturnBody;returnRankingSignals?: boolean;+ returnStructuredData?: boolean;safeSearch?: boolean;selectedRegion?: Region;};export type ApiSearchResult =| (WebsitesResult & {- type: 'websites';+ _type: 'websites';})| (BangHit & {- type: 'bang';+ _type: 'bang';});export type Bang = {c?: string;@@ -227,11 +228,11 @@ export type Calculation = {};export type CodeOrText =| {- type: 'code';+ _type: 'code';value: string;}| {- type: 'text';+ _type: 'text';value: string;};export type Definition = string;@@ -252,11 +253,11 @@ export type DisplayedEntity = {};export type DisplayedSidebar =| {- type: 'entity';+ _type: 'entity';value: DisplayedEntity;}| {- type: 'stackOverflow';+ _type: 'stackOverflow';value: {answer: StackOverflowAnswer;title: string;@@ -273,6 +274,7 @@ export type DisplayedWebpage = {score?: number;site: string;snippet: Snippet;+ structuredData?: StructuredData[];title: string;url: string;};@@ -319,16 +321,18 @@ export type HostsExportOpticParams = {};export type KnowsHost =| {+ _type: 'known';host: string;- type: 'known';}| {- type: 'unknown';+ _type: 'unknown';};export type Lemma = string;export type Node = {name: string;};+export type OneOrManyProperty = Property | Property[];+export type OneOrManyString = string | string[];export type PartOfSpeech = 'noun' | 'verb' | 'adjective' | 'adjectiveSatellite' | 'adverb';export const PART_OF_SPEECHES = ['noun',@@ -341,20 +345,21 @@ export type PartOfSpeechMeaning = {meanings: WordMeaning[];pos: PartOfSpeech;};+export type Property = string | StructuredData;export type Region = 'All' | 'Denmark' | 'France' | 'Germany' | 'Spain' | 'US';export const REGIONS = ['All', 'Denmark', 'France', 'Germany', 'Spain', 'US'] satisfies Region[];export type ReturnBody =| {- type: 'all';+ _type: 'all';}| {- type: 'truncated';+ _type: 'truncated';value: number;};export type RichSnippet = {+ _type: 'stackOverflowQA';answers: StackOverflowAnswer[];question: StackOverflowQuestion;- type: 'stackOverflowQA';};export type ScoredHost = {description?: string;@@ -389,6 +394,9 @@ export type StackOverflowAnswer = {export type StackOverflowQuestion = {body: CodeOrText[];};+export type StructuredData = {+ _type?: OneOrManyString;+};export type Suggestion = {highlighted: HighlightedFragment[];raw: string;@@ -409,11 +417,11 @@ export type WebsitesResult = {};export type Widget =| {- type: 'calculator';+ _type: 'calculator';value: Calculation;}| {- type: 'thesaurus';+ _type: 'thesaurus';value: ThesaurusWidget;};export type WidgetQuery = {diff --git a/frontend/src/lib/search.ts b/frontend/src/lib/search.tsindex f5db4815..4ad2ba79 100644--- a/frontend/src/lib/search.ts+++ b/frontend/src/lib/search.ts@@ -24,14 +24,14 @@ export type SearchParams = {export type SearchResults =| (WebsitesResult & {- type: 'websites';+ _type: 'websites';spellCorrection?: HighlightedSpellCorrection;widget?: Widget;sidebar?: DisplayedSidebar;discussions?: DisplayedWebpage[];})| (BangHit & {- type: 'bang';+ _type: 'bang';});export const extractSearchParams = (searchParams: URLSearchParams | FormData): SearchParams => {@@ -156,10 +156,10 @@ export const search = async (params: SearchParams, options: ApiOptions) => {discussionsReq,spellcheckReq,]);- const discussions = discussionsRes?.type == 'websites' ? discussionsRes.webpages : undefined;+ const discussions = discussionsRes?._type == 'websites' ? discussionsRes.webpages : undefined;const results: SearchResults =- websites.type == 'websites'+ websites._type == 'websites'? {...websites,widget,diff --git a/frontend/src/routes/explore/+page.svelte b/frontend/src/routes/explore/+page.svelteindex 384cfb9b..a7ca863e 100644--- a/frontend/src/routes/explore/+page.svelte+++ b/frontend/src/routes/explore/+page.svelte@@ -72,10 +72,10 @@const result = await api.webgraphHostKnows({ host }).data;match(result)- .with({ type: 'unknown' }, () => {+ .with({ _type: 'unknown' }, () => {errorMessage = true;})- .with({ type: 'known' }, async ({ host }) => {+ .with({ _type: 'known' }, async ({ host }) => {if (clear) inputWebsite = '';if (!chosenHosts.includes(host)) chosenHosts = [...chosenHosts, host];updateBrowserState();diff --git a/frontend/src/routes/explore/+page.ts b/frontend/src/routes/explore/+page.tsindex dd9c472d..c4631d1d 100644--- a/frontend/src/routes/explore/+page.ts+++ b/frontend/src/routes/explore/+page.ts@@ -19,10 +19,10 @@ export const load: PageLoad = async (req) => {const res = await api.webgraphHostKnows({ host }).data;match(res)- .with({ type: 'unknown' }, () => {+ .with({ _type: 'unknown' }, () => {errorMessage = true;})- .with({ type: 'known' }, async ({ host }) => {+ .with({ _type: 'known' }, async ({ host }) => {if (host.length > 0 && !chosenHosts.includes(host)) chosenHosts = [...chosenHosts, host];}).exhaustive();diff --git a/frontend/src/routes/search/+page.svelte b/frontend/src/routes/search/+page.svelteindex ba6347bc..828feb03 100644--- a/frontend/src/routes/search/+page.svelte+++ b/frontend/src/routes/search/+page.svelte@@ -29,7 +29,7 @@prevPageSearchParams = null;}- if (results && results.type == 'websites' && results.hasMoreResults) {+ if (results && results._type == 'websites' && results.hasMoreResults) {const newParams = new URLSearchParams($page.url.searchParams);newParams.set('p', (data.params.currentPage + 1).toString());nextPageSearchParams = newParams;@@ -45,7 +45,7 @@const res = await search(data.params, { fetch: fetch });- if (res.type == 'bang') {+ if (res._type == 'bang') {window.location.replace(res.redirectTo);return null;}@@ -63,7 +63,7 @@let encodedQueryForRedirect = paramsForRedirect.toString();$: {- if (browser && results && results.type == 'websites')+ if (browser && results && results._type == 'websites')updateQueryId({ query, webpages: results.webpages });}diff --git a/frontend/src/routes/search/+page.ts b/frontend/src/routes/search/+page.tsindex 196c0bb6..c5865d9d 100644--- a/frontend/src/routes/search/+page.ts+++ b/frontend/src/routes/search/+page.ts@@ -33,7 +33,7 @@ export const load: PageLoad = async (req) => {});}- if (results && results.type == 'bang') {+ if (results && results._type == 'bang') {redirect(301, results.redirectTo);}diff --git a/frontend/src/routes/search/Result.svelte b/frontend/src/routes/search/Result.svelteindex 6de5fe62..34a6bb2a 100644--- a/frontend/src/routes/search/Result.svelte+++ b/frontend/src/routes/search/Result.svelte@@ -68,7 +68,7 @@<div class="snippet text-sm font-normal text-neutral-focus [&>b]:font-bold">{#if $summary}<Summary url={webpage.url} on:hide={() => clearSummary(webpage)} />- {:else if webpage.richSnippet && webpage.richSnippet.type == 'stackOverflowQA'}+ {:else if webpage.richSnippet && webpage.richSnippet._type == 'stackOverflowQA'}<StackOverflowSnippetquestion={webpage.richSnippet.question}answers={webpage.richSnippet.answers}diff --git a/frontend/src/routes/search/Serp.svelte b/frontend/src/routes/search/Serp.svelteindex ab0816e1..8424a0b0 100644--- a/frontend/src/routes/search/Serp.svelte+++ b/frontend/src/routes/search/Serp.svelte@@ -66,7 +66,7 @@<Modal {query} {modal} />{/if}-{#if results.type == 'websites'}+{#if results._type == 'websites'}<div class="col-start-1 flex min-w-0 max-w-2xl flex-col space-y-5">{#if results.spellCorrection}<SpellCorrection spellCorrection={results.spellCorrection} bind:this={spellCorrectElem} />diff --git a/frontend/src/routes/search/Sidebar.svelte b/frontend/src/routes/search/Sidebar.svelteindex 80f1cd60..a372f289 100644--- a/frontend/src/routes/search/Sidebar.svelte+++ b/frontend/src/routes/search/Sidebar.svelte@@ -6,8 +6,8 @@export let sidebar: DisplayedSidebar;</script>-{#if sidebar.type == 'entity'}+{#if sidebar._type == 'entity'}<Entity entity={sidebar.value} />-{:else if sidebar.type == 'stackOverflow'}+{:else if sidebar._type == 'stackOverflow'}<StackOverflow {...sidebar.value} />{/if}diff --git a/frontend/src/routes/search/StackOverflow.svelte b/frontend/src/routes/search/StackOverflow.svelteindex e289d0f0..5f93a5dd 100644--- a/frontend/src/routes/search/StackOverflow.svelte+++ b/frontend/src/routes/search/StackOverflow.svelte@@ -36,9 +36,9 @@<hr class="border-stone-700" /><div class="inline-block max-h-96 overflow-y-scroll text-sm">{#each answer.body as part}- {#if part.type == 'code'}+ {#if part._type == 'code'}<Code code={part.value} />- {:else if part.type == 'text'}+ {:else if part._type == 'text'}<StackOverflowText text={part.value} />{/if}{/each}diff --git a/frontend/src/routes/search/StackOverflowSnippet.svelte b/frontend/src/routes/search/StackOverflowSnippet.svelteindex 6e7ef646..31cb1dd5 100644--- a/frontend/src/routes/search/StackOverflowSnippet.svelte+++ b/frontend/src/routes/search/StackOverflowSnippet.svelte@@ -12,7 +12,7 @@<div class="line-clamp-2">{#each question.body as passage}- {#if passage.type == 'text'}+ {#if passage._type == 'text'}{passage.value}{/if}{/each}@@ -44,9 +44,9 @@</div><div>{#each answer.body as passage}- {#if passage.type == 'text'}+ {#if passage._type == 'text'}<StackOverflowText text={passage.value} />- {:else if passage.type == 'code'}+ {:else if passage._type == 'code'}<Code code={passage.value} transparentBackground={true} />{/if}{/each}diff --git a/frontend/src/routes/search/Widget.svelte b/frontend/src/routes/search/Widget.svelteindex 4d2ef854..a084a9c2 100644--- a/frontend/src/routes/search/Widget.svelte+++ b/frontend/src/routes/search/Widget.svelte@@ -5,7 +5,7 @@export let widget: Widget;</script>-{#if widget.type == 'calculator'}+{#if widget._type == 'calculator'}<div class="rounded-xl border p-5"><div class="flex flex-col items-end"><div class="flex w-fit text-xs text-neutral">@@ -16,6 +16,6 @@</div></div></div>-{:else if widget.type == 'thesaurus'}+{:else if widget._type == 'thesaurus'}<ThesaurusWidget widget={widget.value} />{/if}diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelteindex c1e71994..738b7b16 100644--- a/frontend/src/routes/settings/+page.svelte+++ b/frontend/src/routes/settings/+page.svelte@@ -11,38 +11,38 @@{title: 'Safe Search',description: 'Remove explicit content from search results',- type: 'safe-search',+ _type: 'safe-search',},{title: 'Theme',description: 'Pick a color scheme',- type: 'theme',+ _type: 'theme',},{title: 'POST Search Requests',description: 'Send search queries using POST instead of GET',- type: 'post',+ _type: 'post',},{title: 'Mark results that contains ads',description: 'Add a marker to search results where it is likely that the page contains ads',- type: 'mark-pages-with-ads',+ _type: 'mark-pages-with-ads',},{title: 'Mark results that contains paywall',description:'Add a marker to search results where it is likely that the page contains a paywall',- type: 'mark-pages-with-paywall',+ _type: 'mark-pages-with-paywall',},{title: 'Open results in a new tab',description: 'Keep the search results window open and have links open in new tabs',- type: 'results-in-new-tabs',+ _type: 'results-in-new-tabs',},{title: 'Keyboard shortcuts',description: 'Enables the use of keyboard shortcuts on the site',- type: 'use-keeb-shortcuts',+ _type: 'use-keeb-shortcuts',},] as const;</script>@@ -59,19 +59,19 @@</div><div class="flex flex-col pr-5 sm:flex-row sm:justify-between sm:space-y-0"><div>- {#if setting.type == 'safe-search'}+ {#if setting._type == 'safe-search'}<SafeSearchSelect />- {:else if setting.type == 'theme'}+ {:else if setting._type == 'theme'}<ThemeSelect />- {:else if setting.type == 'post'}+ {:else if setting._type == 'post'}<PostSearchSelect />- {:else if setting.type == 'mark-pages-with-ads'}+ {:else if setting._type == 'mark-pages-with-ads'}<MarkPagesWithAdsSelect />- {:else if setting.type == 'mark-pages-with-paywall'}+ {:else if setting._type == 'mark-pages-with-paywall'}<MarkPagesWithPaywallSelect />- {:else if setting.type == 'results-in-new-tabs'}+ {:else if setting._type == 'results-in-new-tabs'}<ResultsInNewTabs />- {:else if setting.type == 'use-keeb-shortcuts'}+ {:else if setting._type == 'use-keeb-shortcuts'}<UseKeyboardShortcuts />{/if}</div>