HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.28k stars 2.91k forks source link

Add search feature #169

Closed gcushen closed 6 years ago

gcushen commented 7 years ago

As of Hugo version 0.20.2, the basic functionality is now available to facilitate implementing a search feature in Academic 😃

So far, I have implemented the search index. Next to decide on a third party search provider! I'll provide updates in this thread.

gour commented 7 years ago

Hello,

@Next to decide on a third party search provider! I'll provide updates in this thread.

I've decided to use Hugo instead of Nikola and have info that Tipue search engine plugin can serve without problems sites with several Ks of pages...just a hint? 😉

anayrat commented 6 years ago

I would suggest lunrjs :

gcushen commented 6 years ago

To enable the search widget:

  1. Update Academic if necessary and add the new options to your config.toml (scroll down to config.toml at bb3adc1 to see the config changes)
  2. In home/search.md set active to true to activate the search widget
  3. Register at https://www.algolia.com and follow the steps to create a new search app
  4. Build your site by running hugo command
  5. Upload the generated public/search.json file to the Index page in your Algolia dashboard
  6. Paste the Algolia App ID, API Key, and Index Name into the [params.search.algolia] section in config.toml
  7. Under [params.search] in config.toml, set engine = 1 to enable the search engine
  8. Serve (or build and upload) your new site and test out the shiny new search widget on your home page :)
anayrat commented 6 years ago

Hi, It was not possible with lunrjs ?

Regards,

gcushen commented 6 years ago

@anayrat Client-side search has major limitations in terms of handling misspellings, lack of autocompletion, and most importantly, scalability. Algolia does not have any of these limitations and provide a very generous free plan.

Now that the foundation for searching within Academic has been implemented, we may consider integrating alternative search engines in the future :)

gcushen commented 6 years ago

Documentation and a demo have now been added:

Docs: https://sourcethemes.com/academic/docs/search/ Demo: https://sourcethemes.com/academic/#search

petzi53 commented 6 years ago

Just installed your search. It works fine!

But I am afraid that Algolia does not "provide a very generous free plan". After the registration everyone got 14 trial days. But I thought I will immediately change to the free community plan. So I did it. But when I uploaded my generated search.json file it said that I have exceeded the quota. (I had to register anew, as I could not go back to the 14 trial days.)

I was surprised, because I just have started with my website. It is still not officially launched. I have only 12 posts, but 190 publications; many of them with abstracts. But still this is not much content for a website. The search.json file has 213 kB.

The free plan starts with $ 35 a month (which is already a lot of money!), but the limit for this price is already an index of 50 k. With my still very small website I would have to pay already $ 85 / month!

Sure, there is the option of an Algolia Open Source (AOS) discount, but to qualify you must either develop open source software or be a non-profit organization. In either case this is not the community your Academic framework is targeting.

I hope there will be other, better possibilities. To pay several thousand dollars a year for my personal website just for the search engine would no option for me.

gour commented 6 years ago

I hope there will be other, better possibilities. To pay several thousand dollars a year for my personal website just for the search engine would no option for me.

That's the reason why I'm considering to move to Grav - it is flat-file CMS allowing to write markdown content, no databases, but, otoh, no need to integrate 3rd party services and/or apps to solve the problem of commenting system, search feature, form processing etc.

petzi53 commented 6 years ago

@gour Thanks for the tip. But there are three reason why I will stick to Hugo:

  1. I am using it in relation with R in relation with some other program packages developed in R (bookdown, blogdown, R Markdown)
  2. I trust the R community generally but also this theme developer here (@gcushen) to find solutions for problems. (With Hugo it is a little different: As I working with Hugo only behind the R 'fence', I do not have much experience neither with the software nor with the community. But as I said: I trust the R community.)
    1. I have already invested so much work! I am still fed up from the transfer from WordPress, which still is not yet completed. At the moment I can't even think to change and learn another system…
gour commented 6 years ago

@petzi53 ok, just short comments inline...

  1. Grav uses Markdown Extra flavor which is good-enough for me and no idea how does it compare with R Markdown.

  2. Grav community is very nice and there are lot of themes and, plugins available and one interesting feature are skeletons providing complete samples of web sites for an easy start.

  3. There is WordPress importer available, but I didn't try it since I moved from WP long ago. Moreover, using Grav is fairly easy and you can using it with GUI (Grav admin) or via CLI.

All in all, I just mentioned Grav since I spent lot of time playing/fiddling with static-site-generators (Nikola, Hugo, Pelican...), but at the end I always had a feeling that the missing parts are not so easy/elegant to be replaced and that's why flat-file CMS like Grav is for me kind of sweet-spot. :-)

All the best in resolving your problem with Hugo. ;)

gcushen commented 6 years ago

Grav is PHP based and targeted primarily at the PHP WordPress audience.

Academic's built-in search is now implemented - see #635 and https://sourcethemes.com/academic/docs/search/

petzi53 commented 6 years ago

@gcushen: Re Grav: Thank you for clarifying. Re: Search. Did you read my previous post on this thread?

I thought about the quota. Maybe the Algolia limit with 100k is not referencing the size of the index file but the number of index records. But how can it be that my small site is already exceeding their free quota?

petzi53 commented 6 years ago

Search Algolia again: I just received the Algolia "Usage from Aug 06 to Aug 12". And here the statistics shows only 211 records. I have asked them why I couldn't register for community membership and why my upload was rejected, claiming that I had exceeded their quota. I am waiting for their answer…

petzi53 commented 6 years ago

Report on my contact with Algolia: I am now waiting almost 20 days for an answer. 4 different people from Algoloa have already contacted me, but nobody has known from the other people and nobody has addressed my problem. They just wanted to sell me their product. My 3 weeks grace period is running out…

I have to confess: My trust into Algolia is not very high. –– Hopefully you are looking for another/additional search engine solution