# Adding a Typesense search engine to a website

**URL:** <https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416>\
**Category:** Xway\
**Created:** [October 30, 2026, 6:50pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416 "2026-10-30T18:50:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulwcarter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/p/ce73a5/32.png) [@paulwcarter](https://discourse.softpress.com/u/paulwcarter)\
**Post date:** [October 30, 2026, 6:50pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/1 "2026-10-30T18:50:17Z")

</div>

I am building an online archive site for 147 issues of a community newspaper. I am interested in seeing if the Typesense search engine might be integrated into the site to provide search results from the site pages and the newspaper files. The newspaper page files will be in html generated by Google Vision OCR using NLP.

I asked Claude about a possible work flow and got the answer below.

Any advice would be helpful. Thanks.

Paul

==========

To add a search engine to a flat website using Typesense, you first set up a Typesense server (self-hosted or via Typesense Cloud), then use its InstantSearch.js adapter to connect your site and display search results with a simple JavaScript widget.

**Setting Up Typesense for Your Flat Website**

To integrate a search engine into your flat website using Typesense, follow these steps:

1. Set Up Typesense Server

You can choose between two options for setting up your Typesense server:

- Self-Hosted: Install Typesense on your own server.
- Typesense Cloud: Use the managed service for easier setup and maintenance.

2. Configure Your Typesense Collection

Once your server is running, create a collection to store your searchable documents. This involves:

- Defining the collection name.
- Specifying the fields to be indexed (e.g., title, description).

3. Index Your Data

Upload your documents to the Typesense collection. This can be done using the Typesense API, where you send your data in JSON format.

4. Integrate InstantSearch.js

To display search results on your website, use the InstantSearch.js adapter. Here’s how to set it up:

1. Install InstantSearch.js: Include the library in your project.

2. Create a Configuration File: Set up a JavaScript file to connect to your Typesense server. Here’s a basic example:

import TypesenseInstantSearchAdapter from “typesense-instantsearch-adapter”;

const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({

server: {

apiKey: “YOUR\_API\_KEY”,

nodes: [

{

host: “YOUR\_TYPESENSE\_HOST”,

port: 8108,

protocol: “http”,

},

],

},

additionalSearchParameters: {

query\_by: “title,description”,

},

});

5. Implement Search Functionality

Use the InstantSearch.js widgets to create a search interface. Here’s a simple setup:

- Search Box: For user input.
- Hits Display: To show search results.
- Stats Widget: To display the number of results found.

Example Code Snippet

javascript

const search = instantsearch({

indexName: ‘your\_collection\_name’,

searchClient: typesenseInstantsearchAdapter.searchClient,

});

search.addWidgets([

searchBox({

container: ‘#searchbox’,

placeholder: ‘Search…’,

}),

hits({

container: ‘#hits’,

templates: {

item(hit) {

return `

${hit.title}
`;

},

},

}),

]);

search.start();

6. Test Your Search

After implementing the above steps, test your search functionality to ensure it works as expected. Adjust the configuration as needed for optimal performance.

By following these steps, you can successfully add a search engine to your flat website using Typesense.

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [November 2, 2026, 3:42pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/2 "2026-11-02T15:42:44Z")

</div>

Hi Paul,

There’s also a [Quick start](https://typesense.org/docs/guide/#quick-start) page on the Typesense website.

I don’t have any personal experience with Typesense, but I’m happy to answer any Xway-related questions.

---

<div class="post-metadata">

**Author:** ![paulwcarter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/p/ce73a5/32.png) [@paulwcarter](https://discourse.softpress.com/u/paulwcarter)\
**Post date:** [November 2, 2026, 4:12pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/3 "2026-11-02T16:12:57Z")

</div>

Thanks, Jeremy. A friend of mine who is familiar with search engines and javascript will be doing the main work, so I will pass on any queries that he may have.

So as far as you know there is nothing within Xway’s structure that might create any problems?

Cheers

Paul

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [November 2, 2026, 4:48pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/4 "2026-11-02T16:48:28Z")

</div>

I don’t think there should be any problems.

You should be able to use **JavaScript Markup** (in the **Page Inspector** ) and markup items to incorporate JavaScript along with any HTML widgets that you need.

---

<div class="post-metadata">

**Author:** ![paulwcarter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/p/ce73a5/32.png) [@paulwcarter](https://discourse.softpress.com/u/paulwcarter)\
**Post date:** [November 2, 2026, 5:02pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/5 "2026-11-02T17:02:23Z")

</div>

That’s what I was hoping. We will have a crack at it and see how we get on.

Thanks.

Paul

---

<div class="post-metadata">

**Author:** ![josephlewis](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/j/3ec8ea/32.png) [@josephlewis](https://discourse.softpress.com/u/josephlewis)\
**Post date:** [November 21, 2026, 7:46pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/6 "2026-11-21T19:46:55Z")

</div>

One practical caveat: anything in that JavaScript config is visible to visitors, so use a Typesense search-only API key restricted to your collection rather than the admin key. Also make sure the node protocol matches your site: if the archive is served over HTTPS, use https/Typesense Cloud or a TLS-terminated proxy, otherwise browsers will block the request. For the OCR pages, index a clean text field plus title/issue/date fields so filtering by issue stays straightforward.

---

<div class="post-metadata">

**Author:** ![paulwcarter](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/p/ce73a5/32.png) [@paulwcarter](https://discourse.softpress.com/u/paulwcarter)\
**Post date:** [November 22, 2026, 1:04pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/7 "2026-11-22T13:04:36Z")

</div>

Thank you for this heads-up, Joseph.

My tech helper Dan is aware of this pitfall, but is pleased to get your “spot on" advice.

One slight difference is that Dan is planning to use the local version of Typesense, but he thinks your advice will still stand. He is going to write a small php file that "will take the search requests on the same domain as the site and forward them to the search engine running on our server. The requests will be local to the machine, so that file acts as a proxy”.

Dan thinks, for indexing purposes, there is an argument for the issue files being stored together in a separate folder. After linking to the files in Xway is there a way of storing them together on save rather than being among the other items in the Resources folder?

---

<div class="post-metadata">

**Author:** ![Jeremy](https://discourse.softpress.com/user_avatar/discourse.softpress.com/jeremy/32/2740_2.png) [@Jeremy](https://discourse.softpress.com/u/Jeremy)\
**Post date:** [November 23, 2026, 2:17pm UTC](https://discourse.softpress.com/t/adding-a-typesense-search-engine-to-a-website/26416/8 "2026-11-23T14:17:57Z")

</div>

> [@paulwcarter](#):
>
> Dan thinks, for indexing purposes, there is an argument for the issue files being stored together in a separate folder. After linking to the files in Xway is there a way of storing them together on save rather than being among the other items in the Resources folder?

Hi Paul,

Are you using Resource links to link to the “issues files”? In that case they will be stored in the Resources folder (in the Xway document) and output in the resources folder (in the Site folder).

If you’d like to keep them somewhere else, you could use a third-party app to upload them to a separate folder (`issues` or whatever) and link to them using External links. If the files are in an `issues` folder in the root of your website, you can use a full external link (`https://example.com/issues/[filename]`) or a short relative link (`/issues/[filename]`). Short links will work online but they won’t work in local previews.

If you have **Delete destination files and folders that aren’t in the Site folder** selected in the **Upload** dialog, add the name of the online folder (e.g. `issues`) to the **Don’t Delete** list.
