Algolia plugin indexation


(Matthieu Lamarque) #1

Hello,
this is a little plugin which allow to index data in Algolia Indexes.

This plugin is work in progress to fetch data from front-office.

it’s, of course, open source, so help / feedback is welcome.


(Bas van Leeuwen) #2

Hi @matthieu_lamarque,

I’d love to get this working! But I’m having some issues with the Docker install.

If you follow the original instructions, it won’t work, since it’ll be removed after a rebuild. So I guess I need to somehow get this into the app.yml

Simply adding any of the following variations to app.yml yields errors and I don’t have the Ruby/Docker knowledge to debug them properly.

bundle exec rake plugin:install repo=https://github.com/mlamarque/algoliasearch-discourse.git
rake plugin:install repo=https://github.com/mlamarque/algoliasearch-discourse.git
git clone https://github.com/mlamarque/algoliasearch-discourse.git

They all yield (a variation of) NameError: uninitialized constant AlgoliaSearch

I have a feeling it’s a simple fix, if you or anyone else can, please help :slight_smile:


Add Algolia search to your Discourse
(Felix Freiberger) #3

Yes, that’s it. Here’s how you do that:


(Bas van Leeuwen) #4

Hey Felix, that’s exactly where I’m stuck :slight_smile:

My current app.yml contains;

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/vinkas0/discourse-navigation.git
          - git clone https://github.com/vinkas0/discourse-branding.git
          - git clone https://github.com/discourse/discourse-solved.git

          - git clone https://github.com/mlamarque/algoliasearch-discourse.git

The first three load perfectly fine, the last one fails


(Felix Freiberger) #5

YAML is very picky about whitespace. Remove the blank line (which contains a space) and make sure there aren’t any tabs in there, then try again :slight_smile:


(Bas van Leeuwen) #6

Thanks for the debugging, but that’s not it either unfortunately

this fails:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/vinkas0/discourse-navigation.git
          - git clone https://github.com/vinkas0/discourse-branding.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/mlamarque/algoliasearch-discourse.git

this works (but of course, doesn’t install the plugin):

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/vinkas0/discourse-navigation.git
          - git clone https://github.com/vinkas0/discourse-branding.git
          - git clone https://github.com/discourse/discourse-solved.git
#          - git clone https://github.com/mlamarque/algoliasearch-discourse.git

(Felix Freiberger) #7

Can you post the log from the rebuild command?

The plugin may be incompatible with current versions of Discourse.


(Bas van Leeuwen) #8

Yeah, I’m afraid that it might be outdated :frowning:

Log is rather long, relevant part:

(...)
Bundled gems are installed into ./vendor/bundle.

I, [2017-08-03T11:42:56.485801 #14]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
rake aborted!
NameError: uninitialized constant AlgoliaSearch
/var/www/discourse/plugins/algoliasearch-discourse/plugin.rb:9:in `block in activate!'
/var/www/discourse/lib/plugin/instance.rb:208:in `block in notify_after_initialize'
(...)

Full log: log.txt.gz (41.9 KB)


(Bas van Leeuwen) #9

fyi: one of our Ruby devs made a PR on this which was accepted :slight_smile:

Plugin is no longer #plugin:broken-plugin