|
| 1 | +/** |
| 2 | + * Orama Search Configuration for Deno Docs |
| 3 | + * |
| 4 | + * This file contains configuration examples and documentation for setting up |
| 5 | + * Orama search. The actual indexing configuration is done in the Orama Cloud dashboard. |
| 6 | + * |
| 7 | + * Setup Process: |
| 8 | + * 1. Sign up at https://cloud.oramasearch.com/ |
| 9 | + * 2. Create a new index |
| 10 | + * 3. Configure your data source using the examples below |
| 11 | + * 4. Copy your endpoint and API key to search.client.ts |
| 12 | + */ |
| 13 | + |
| 14 | +// These are the credentials you need to add to search.client.ts |
| 15 | +const ORAMA_CREDENTIALS = { |
| 16 | + endpoint: "https://cloud.orama.run/v1/indexes/your-index-id-here", |
| 17 | + apiKey: "your-public-api-key-here", |
| 18 | +}; |
| 19 | + |
| 20 | +// Recommended Web Crawler Configuration for Orama Cloud Dashboard |
| 21 | +// Copy these settings into your Orama Cloud index configuration: |
| 22 | + |
| 23 | +const RECOMMENDED_CRAWLER_CONFIG = { |
| 24 | + // Base URL to crawl |
| 25 | + startUrl: "https://docs.deno.com", |
| 26 | + |
| 27 | + // URLs to include (use these patterns in the Orama dashboard) |
| 28 | + includePatterns: [ |
| 29 | + "https://docs.deno.com/runtime/**", |
| 30 | + "https://docs.deno.com/deploy/**", |
| 31 | + "https://docs.deno.com/examples/**", |
| 32 | + "https://docs.deno.com/api/**", |
| 33 | + ], |
| 34 | + |
| 35 | + // URLs to exclude (use these patterns in the Orama dashboard) |
| 36 | + excludePatterns: [ |
| 37 | + "https://docs.deno.com/_site/**", |
| 38 | + "https://docs.deno.com/img/**", |
| 39 | + "https://docs.deno.com/fonts/**", |
| 40 | + "https://docs.deno.com/js/**", |
| 41 | + ], |
| 42 | + |
| 43 | + // CSS selectors to INCLUDE (main content areas only) |
| 44 | + // Add these in the "Content Selectors" section of Orama dashboard |
| 45 | + includeSelectors: [ |
| 46 | + "main", // Main content area |
| 47 | + "article", // Article content |
| 48 | + ".content", // Content containers |
| 49 | + ".documentation", // Documentation sections |
| 50 | + "[role='main']", // ARIA main content |
| 51 | + ".markdown-body", // If using markdown rendering |
| 52 | + ], |
| 53 | + |
| 54 | + // CSS selectors to EXCLUDE (navigation and UI elements) |
| 55 | + // Add these in the "Exclude Selectors" section of Orama dashboard |
| 56 | + excludeSelectors: [ |
| 57 | + "nav", // Navigation elements |
| 58 | + ".navigation", // Navigation classes |
| 59 | + ".nav", // Nav classes |
| 60 | + ".navbar", // Navbar |
| 61 | + ".sidebar", // Sidebar navigation |
| 62 | + ".breadcrumb", // Breadcrumbs |
| 63 | + ".breadcrumbs", // Breadcrumbs |
| 64 | + ".header", // Page headers |
| 65 | + ".footer", // Page footers |
| 66 | + ".menu", // Menu elements |
| 67 | + ".toc", // Table of contents |
| 68 | + ".table-of-contents", // Table of contents |
| 69 | + "[role='navigation']", // ARIA navigation |
| 70 | + "[role='banner']", // ARIA banner (header) |
| 71 | + "[role='contentinfo']", // ARIA contentinfo (footer) |
| 72 | + ".search", // Search components |
| 73 | + ".search-input", // Search inputs |
| 74 | + ".tabs", // Tab navigation |
| 75 | + ".tab-nav", // Tab navigation |
| 76 | + ".pagination", // Pagination |
| 77 | + ".social-links", // Social media links |
| 78 | + ".edit-page", // Edit page links |
| 79 | + ".github-link", // GitHub links |
| 80 | + ], |
| 81 | + |
| 82 | + // Content filtering settings |
| 83 | + minContentLength: 50, // Skip content shorter than 50 characters |
| 84 | + maxContentLength: 10000, // Limit very long content |
| 85 | +}; |
| 86 | + |
| 87 | +// Field mapping for your documents (configure in Orama dashboard) |
| 88 | +const FIELD_MAPPING = { |
| 89 | + // These fields will be created in your Orama index |
| 90 | + title: "string", // Page title |
| 91 | + content: "string", // Main content |
| 92 | + url: "string", // Page URL/path |
| 93 | + category: "string", // Content category (runtime, deploy, etc.) |
| 94 | + section: "string", // Section within category |
| 95 | + tags: "string[]", // Tags array |
| 96 | +}; |
| 97 | + |
| 98 | +// How to configure this in Orama Cloud Dashboard: |
| 99 | +const SETUP_INSTRUCTIONS = ` |
| 100 | +1. Go to https://cloud.oramasearch.com/ |
| 101 | +2. Create a new index |
| 102 | +3. Choose "Web Crawler" as data source |
| 103 | +4. Configure the crawler with these settings: |
| 104 | +
|
| 105 | + Base URL: https://docs.deno.com |
| 106 | + |
| 107 | + Include Patterns (one per line): |
| 108 | + https://docs.deno.com/runtime/** |
| 109 | + https://docs.deno.com/deploy/** |
| 110 | + https://docs.deno.com/examples/** |
| 111 | + https://docs.deno.com/api/** |
| 112 | + |
| 113 | + Exclude Patterns (one per line): |
| 114 | + https://docs.deno.com/_site/** |
| 115 | + https://docs.deno.com/img/** |
| 116 | + https://docs.deno.com/fonts/** |
| 117 | + https://docs.deno.com/js/** |
| 118 | + |
| 119 | + Content Selectors (Include - one per line): |
| 120 | + main |
| 121 | + article |
| 122 | + .content |
| 123 | + .documentation |
| 124 | + [role="main"] |
| 125 | + |
| 126 | + Exclude Selectors (one per line): |
| 127 | + nav |
| 128 | + .navigation |
| 129 | + .sidebar |
| 130 | + .breadcrumb |
| 131 | + .header |
| 132 | + .footer |
| 133 | + .menu |
| 134 | + [role="navigation"] |
| 135 | + |
| 136 | + Content Filtering: |
| 137 | + Minimum content length: 50 |
| 138 | + |
| 139 | +5. Run the crawler |
| 140 | +6. Copy your endpoint and API key to search.client.ts |
| 141 | +`; |
| 142 | + |
| 143 | +export { |
| 144 | + FIELD_MAPPING, |
| 145 | + ORAMA_CREDENTIALS, |
| 146 | + RECOMMENDED_CRAWLER_CONFIG, |
| 147 | + SETUP_INSTRUCTIONS, |
| 148 | +}; |
0 commit comments