Native search index rebuild

Hello,
I’m running Ghost Blog as a docker container for quite a while now and am very happy.
Since some version, a native search has popped up.
Which I like very much!

BUT: I have problems finding content. Mainly content that was written earlier this year and wasn’t touched after … about Spring / early Summer 2024 ?
For example, I have 2 Posts on my site, that are about the french island corsica, and I search for the term “Korsika” (german written form), only 1 of the 2 gets returned, even though both have exactly 1 occurence of “Korsika” in them.

Now it gets interesting:
the post that gets returned, was also invisible, until I “edited” it by opening, adding a dot, and update / closing it.
So I assume, that posts get added to the search index when you edit / create them.
But if you have older posts, these are omitted.
Also, Post Titles and Tags are not affected by this, only content.

My question is now:
How can I rebuild the entire search index once, to get all posts in it?

Thanks in advance,
William

The built-in search only searches titles, tags, authors, and excerpts. I wonder if that explains the discrepancy?

well yes, but - why then does it find stuff in the content of some posts?

Also I’d like to know anyways, how to rebuild the index of the native search, regardless of whether it finds only titles, tags,authors and excerpts.

Quick summary of how native search works: There’s a javascript app (sodo-search) that retrieves post content from the content API. Then it loads what comes out of the contentAPI into flexsearch, and uses that client-side database to handle your search queries. It’s all happening client-side.

If you wanted to link your site, I’d be interested to see if there’s anything obviously different about the posts that are/are not showing up in the index.

You mentioned this being an older install. It’s possible that you’re running an older version of a theme that implements its own search – so it’s possible that you’re seeing that behavior, not the sodo-search behavior. I know that some versions of Dawn stored their search index in the browser’s LocalStorage…

Oh, its CLIENT side?!
I’m using a recent version of casper. modded it a bit to implement dropdown menus and a fullscreen cover-image.

can you try searching for “Korsika” here: https://campers-logbook.de/ ?
you should get a bunch of “Stellplatz” Posts and “Woche 39” and “Woche 38” (not shown in my browser)

thanks …

I’ve got the same results you do.
No Woche 38. I don’t see Korsika in the title, excerpt, or tag. (If you search for Woche 38 itself, you’ll see that it’s indexed.) If Korsika is an important search term, make sure it’s available in one of the places that sodo-search will look.

Sodo-search doesn’t search post bodies because you’re relying on the client to do the search, and it just isn’t that good.

One of these days, I’m going to do a mod that uses the sodo-search front end but actually searches Algolia. One of these days…

1 Like

… but sometimes it does? or how would you explain the results we get?

sorry, Im just curious. there doesnt need to be a solution, I just want an explanation now what is happening.

sodo-search does search excerpts, and excerpts are usually the first few hundred characters of the body, so that might be why :slight_smile:

1 Like

ah yes that could be the difference between Woche 39 and 38, where the latter has the word way down in the text.

1 Like