I am not quite sure of your issue root cause but if you are using the default parameters, you should probably set the minimum number of parameters. For example, copy and paste the following in your footer script section :
<script src="https://cdn.jsdelivr.net/gh/gmfmi/searchinghost-easy@latest/dist/searchinghost-easy-basic.js"></script>
<script>
new SearchinGhostEasy({
contentApiKey: '<CONTENT_API_KEY>', // do not forget to replace this with your own key
debug: true
});
</script>
Then, if nothing shows up, go to your browser console to see if anything is logged
Generally, on mobile device, the issue comes from local storage and cache. Try from a âprivate browsingâ tab to see if it works.
Persistence: Sometimes a search result on a common term will return 10 or more results as everything on my site (thechocolatelife.com) shares a common topic. I click on one result, itâs not what I want. Iâve opened a new page and the search has been cleared. I then need to re-enter the search term. Persistence would mean the last search term was pre-populated and the search would be done again without requiring user input. Saving time. This should probably be a configuration option.
A nice UI/UX refinement would be to add a âclear this searchâ icon/function in the search text box.
I would recommend talking to the FlexSearch people about adding sort options. Sometimes I want to know the oldest result, sometimes the newest â and so ârelevanceâ is not relevant to me. I know the post date is in the result â but itâs a pretty heavy cognitive burden to read through every result for the oldest/newest article when there are many.
@inoryum letâs discuss tuning the search parameters when all the new articles are added â and adding the tag to the search results template.
Sorry for the late reply, I checked you website and the issue is not coming from the search plugin itself but from the menu displayed for mobile. For example, I you resize you web browser to be as thin as a tablet or a mobile, you will get the exact same issue on a laptop.
I did not dig deeper but you should take a closer look on the theme side. Try to know why the link /#searchinghost-easy is called instead of just #searchinghost-easy. Because of that, a page reload is triggered so you will never see the search box.
Thank you for the explanation. I never though it this way but that is very interesting. I am very busy right now but I really hope I will find some free time to implement the âpersistenceâ feature.
About the sort option, though it is technically feasible, it would required dedicated development and that goes beyond the SearchinGhost âtool for everyoneâ scope. But, an option is to always sort the displayed results with the newest first. And you can do that on your own
I have to say it but⊠going on your blog is a torture. I love chocolate and now the only thing I can think of is⊠to eat any bite of chocolate I can find in my house !
I also saw that, with 446 posts, you exceeded the quota allowed by browsers. Now, you should definitely think of indexing only posts titles to give a smoother experience to your users.
Nothing to do with FlexSearch, it is purely a browser limitation. You can check this stackoverflow thread for more details.
And just to be clear, what we store is a JSON representation of the built index from FlexSearch. So when you use the default âfull-text indexationâ, you actually try to store all your articles content in the visitor browser. That is why getting rid of the content will fix the issue.
@gmfmi thanks for the clarification about how SearchinGhostEASY works. Obviously it is not scalable to load every word of every post into memory and index it there.
I think the question I was really trying to ask was about using FlexSearch with Ghost to get around the memory limitation. My members are used to have full-text search, not just the ability to search the post titles.
When you say âFlexSearch with Ghostâ, do you mean ârunning FlexSearch on the server side, so the client will send a request at each key stroke with its search word, it will be proceed by the server and then a response will be send back to the clientâ ? Just to be sure.
If it is what you meant, it is totally doable but that is a whole different story. I think it would take about 3 days to setup something ready for production (nodejs code, integration and security concerns). But I donât know if it is a good idea. At that point, maybe it would be smarter to go with already existing full-fledge solution like MeiliSearch, Elasticsearch or equivalent.
What would be really awesome is to setup an integration plugin accessible from the native Ghost admin panel. But for now, I did not find documentation about itâŠ
I have been investigating GhostHunter and Typesense (leaning towards Typesense). I have some experience with Elastic Search but with awesome power comes a lot more admin overhead than I want to support. MeiliSearch seems like it might be easier to install and maintain than Typesense, and I especially like the thesaurus capabilities, which are attractive for a tightly focused content site like mine (cocoa and chocolate) and I want to deploy a thesaurus, anyway.
An API integration into the Ghost Admins is appealing for a bunch of reasons and so something to consider as well.
Ah, thatâs why. And pretty annoying too, because I specifically asked Ghost if I could include code injections at the low tier, and they said yes. Since this search function is nothing but a code injection one should be allowed to use it, I think. I will have a chat with them about it. Hopefully they see it this way too.
Thanks for this great search tool - perfect for non-coders like me.
Iâve just added a collection to my site for newsletters and excluded these posts (tagged newsletter) from the home page.
Is there a way I could exclude the newsletter posts from the search results?
Thanks
Pete
Hi @petem64, thank you for the kind words. Good news, I got a solution for you .
To discard all posts from a specific category (which are actually tags), you can remove them in the customProcessing of the searchinghost inner library. I tested on your website posts and it works well. Here is working example configuration:
new SearchinGhostEasy({
contentApiKey: '...',
searchinghostOptions:{
customProcessing: function(post) {
if (post.tags) post.string_tags = post.tags.map(o => o.name).join(' ').toLowerCase();
// discard any 'newsletter' post
for (tag of post.tags) {
if (['newsletter'].includes(tag.slug)) {
return null;
}
}
return post;
}
}
});
Here, I excluded any post with a newsletter tag. If you need to exclude several types of posts, simply add other tags to the list.
If it is not clear enough, feel free to send me a DM.
I quickly checked your website, the issue is coming from the API key format. Currently, you are using
<script>
new SearchinGhostEasy({
contentApiKey: '<d5860ecaaf38ccee869cdb6a67>'
});
</script>
but the API key needs to be declared WITHOUT the extra brackets. To solve your issue, please replace the code above by the following one on your website:
<script>
new SearchinGhostEasy({
contentApiKey: 'd5860ecaaf38ccee869cdb6a67'
});
</script>