# Fumadocs (Framework Mode, Astro): Custom Search
URL: /docs/astro/search/custom
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/(framework)/[framework]/search/custom.mdx

For other search solutions.

## Overview [#overview]

You can integrate any search engine with Fumadocs.

### Search Indexes [#search-indexes]

`@fumadocs/astro` exposes the search indexes of your pages at runtime.

To export them statically, add a pre-rendered `static.json` route, and process its records with a script after each build:

```ts tab="src/pages/static.json.ts"
import type { APIRoute } from 'astro';
import { source } from '@/lib/source';

async function getDocuments() {
  const documents = [];
  for (const page of source.getPages()) {
    documents.push({
      structured: await page.data.structuredData(),
      url: page.url,
      title: page.data.title,
      description: page.data.description,
    });
  }
  return documents;
}

export const prerender = true;

export const GET: APIRoute = async () => Response.json(await getDocuments());

```

```ts tab="scripts/sync-content.ts"
import * as fs from 'node:fs/promises';
import type { StructuredData } from 'fumadocs-core/mdx-plugins';

interface DocumentRecord {
  title: string;
  description?: string;
  url: string;
  structured: StructuredData;
}

const records = JSON.parse(await fs.readFile('dist/static.json', 'utf-8')) as DocumentRecord[];

// sync the records to your search engine

console.log(`search updated: ${records.length} records`);

```

```json tab="package.json"
{
  "scripts": {
    "build": "astro build && node --env-file-if-exists=.env.local scripts/sync-content.ts"
  }
}
```

The `structured` field holds the headings and paragraphs of each page. Use it to generate accurate search indexes.