latest | search filters

This commit is contained in:
babayaga 2026-01-20 18:25:36 +01:00
parent 7f63b07df5
commit 3f4f189870
5 changed files with 36 additions and 4 deletions

View File

@ -33,6 +33,7 @@ export declare const zodSchemaBase: () => z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -66,6 +67,7 @@ export declare const zodSchemaBase: () => z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -99,6 +101,7 @@ export declare const zodSchemaBase: () => z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -133,6 +136,7 @@ export declare const zodSchema: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -166,6 +170,7 @@ export declare const zodSchema: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -199,6 +204,7 @@ export declare const zodSchema: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -232,6 +238,7 @@ export declare const zodSchema: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -265,6 +272,7 @@ export declare const zodSchema: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -329,6 +337,7 @@ export declare const zodSchemaEach: () => z.ZodEffects<z.ZodObject<{
source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>]>>;
type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
zoom: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
excludedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
index: z.ZodOptional<z.ZodString>;
store: z.ZodOptional<z.ZodString>;
variables: z.ZodOptional<z.ZodAny>;
@ -372,6 +381,7 @@ export declare const zodSchemaEach: () => z.ZodEffects<z.ZodObject<{
searchFrom?: string;
source?: string | Record<string, string[]>;
zoom?: number;
excludedTypes?: string[];
index?: string;
store?: string;
variables?: any;
@ -413,6 +423,7 @@ export declare const zodSchemaEach: () => z.ZodEffects<z.ZodObject<{
searchFrom?: string;
source?: string | Record<string, string[]>;
zoom?: number;
excludedTypes?: string[];
index?: string;
store?: string;
variables?: any;
@ -454,6 +465,7 @@ export declare const zodSchemaEach: () => z.ZodEffects<z.ZodObject<{
searchFrom?: string;
source?: string | Record<string, string[]>;
zoom?: number;
excludedTypes?: string[];
index?: string;
store?: string;
variables?: any;
@ -495,6 +507,7 @@ export declare const zodSchemaEach: () => z.ZodEffects<z.ZodObject<{
searchFrom?: string;
source?: string | Record<string, string[]>;
zoom?: number;
excludedTypes?: string[];
index?: string;
store?: string;
variables?: any;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -44,6 +44,7 @@ export const zodSchemaBase = () =>
source: z.union([z.string(), z.record(z.string(), z.array(z.string()))]).optional(),
type: z.string().optional().default('search'),
zoom: z.number().optional().default(12),
excludedTypes: z.array(z.string()).optional().describe('Types to exclude'),
//index: z.string().optional().default('${OSR_ROOT}/osr-directory/meta/index.json').describe('Index file'),
//store: z.string().optional().default('${OSR_ROOT}/osr-directory/meta/index.db').describe('Index store'),
index: z.string().optional().describe('Index file'),

View File

@ -200,7 +200,7 @@ export const searchGoogleMap = async (
results = results.filter((r) => r.geo.city.toLowerCase() === opts.filterCity.toLowerCase())
}
if (opts.filterCountry) {
// results = results.filter((r) => r.geo.countryName.toLowerCase() === opts.filterCountry.toLowerCase())
results = results.filter((r) => r.geo.countryName.toLowerCase() === opts.filterCountry.toLowerCase())
}
if (opts.filterContinent) {
results = results.filter((r) => r.geo.continent.toLowerCase() === opts.filterContinent.toLowerCase())
@ -208,6 +208,14 @@ export const searchGoogleMap = async (
if (opts.filterType) {
results = results.filter((r) => r.type === opts.filterType)
}
if (opts.excludedTypes && opts.excludedTypes.length > 0) {
results = results.filter((r) => {
// If result has no types, keep it (conservative)
if (!r.types || r.types.length === 0) return true
// If ANY of result types matches ANY of excluded types, filter it OUT
return !r.types.some(t => opts.excludedTypes!.includes(t))
})
}
results = results.filter((r) => r.gps_coordinates)
const beforeCached = results.length