SearchinGhost - the new search plugin competitor

@thimiraonline, you already are since you use the latest version of Ghost Easybar :wink:

1 Like

I think I’m on 1.3.0.

@thimiraonline, always read the CHANGELOG to see if it is useful for you. In your case, v1.3.0 is more than fine :wink:

Extract:

[1.3.1] - 2020-05-23

Added

  • Ability to set inputId to false when no input field is needed.
1 Like

Thank you for making this, it works perfectly and it is blazing fast. My website has not had search ever working so smoothly and so functionally. Before it wouldn’t search by content or tag, and if you typed like ten characters it would crash. Now it’s seamless!

1 Like

@gmfmi Thanks for sharing your work! I’ve checked it out and replaced our previous implementation of Ghosthunter. My reason for searching is that it was more easily modified to also search for tags, author, and post body. Ghosthunter allowed searching of post body out of the box but it was too slow (at least with our content). SearchinGhost allows searching of post body but quickly.

If I can provide one piece of feedback, it’d be nice if we could skip childOutputType and append the results of the template function without getting wrapped in an element. If that’s already a possibility and I misunderstood the docs sorry for my mistake.

Great job, pretty happy so far!

1 Like

Thank you @sashinexists. Happy to read that :slightly_smiling_face: I took a look at your blog and I have a few tips to make improvements (you will receive that in a private message).

Hi @ijongkim, thanks for the feedback! For now, it is not possible to skip childOutputType. Could you give me more context about it, I don’t understand why would you not use a wrapper element? You want to put all the results next to each other without any structure? For what particuliar reason would you do that?

1 Like

I don’t understand why would you not use a wrapper element? You want to put all the results next to each other without any structure? For what particuliar reason would you do that?

It’s simply not necessary to have individually wrapped items, that’s all. Here’s a screenshot of the DOM structure:

The results render inside div#results so the additional li tag is unnecessary. It’s not a deal breaker for me as the additional li tag doesn’t break anything but it might break things for others and may also make implementation into an existing site easier to be able to skip childOutputType.

It would also be a fairly easy fix as well to allow null value to indicate skipping the rendering of a wrapper element. Looking at your current source code though, I can see why the wrapping element is a requirement.

One solution is to check for childOutputType inside of display() and calling a different function if childOutputType === null. This alternate function would take the returned value from this.config.template and append it to the output element using insertAdjacentHTML.

Happy to submit a PR if that’s easier.

OK, I got the point. In your case, the anchors are also the wrapping elements.

If you want to, I will accept a PR with pleasure. Also, take into account that:

  • do not forget the empty template case
  • the config value to disable childElement is ‘false’

If you need more guide lines, send me a private message or create a GitHub issue. Happy coding! :grinning:

In any case, I will release a new version in 2-3 days with that update included.

@gmfmi

I’ve created an issue and proposed two approaches. One would be appending the strings provided by the template and emptyTemplate functions using insertAdjacentHTML as discussed above.

The other is to expect the template and emptyTemplate to return proper Elements and those could be inserted using appendChild.

The benefit of the first approach is that users won’t have to refactor their template or emptyTemplate functions to take advantage of this option.

The benefit of the second approach is that it requires only a single check in evaluateTemplate() and the rest of your code in display() can remain as is.

GH Issue can be found here

Hi @gmfmi

I have opened an issue in GitHub for the easybar.

Issue No 2

Please make your kind assist in advance.

1 Like