Giter Club home page Giter Club logo

algoliasearch-jekyll's Introduction

Algolia Jekyll Plugin

⚠️ DEPRECATION NOTICE

This gem has been deprecated in favor of jekyll-algolia. No further development will be happening on that gem.

We strongly encourage you to try the new gem. It is officially supported by Algolia and you can find its complete documentation online. A migration guide will help you transition.

algoliasearch-jekyll's People

Contributors

borisschapira avatar david-boles avatar gaven avatar haroenv avatar j-f1 avatar jackub avatar pixelastic avatar redox avatar shipow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

algoliasearch-jekyll's Issues

Possibility to dissociate build and push

Hi!

I use a CI process for my Jekyll website with a double test gate:

  1. I test my blog posts (in fact, a script verifies that all Front Matter are valid YAML)
  2. I build my website
  3. I test the result with html-proofer
  4. If everything is good, I push the _site directory to Production and index the content in Algolia

As my building and indexing phases are separate, my CI process is very long because in order to index, the plugin re-build the website. I know that there is a way to tell the plugin to build the index (hence, the website) without pushing. Is there a way to tell the plugin to push the index without re-building, assuming the previous index is in cache?

Typo in README

return true if filepath =~ %r{^/excluded_dir/} needs to be changed to return true if file.path =~ %r{^/excluded_dir/}

Content not rendered with Liquid before indexing?

Hi there,

I have a Jekyll site that uses the https://github.com/rustygeldmacher/jekyll-contentblocks plugin, and also some {% include … %} blocks. I was experimenting with the Algolia search plugin, and found out that it wasn't processing Liquid blocks on my content.

I have replaced

document = Nokogiri::HTML(@file.content)

with

content = Jekyll::Renderer.new(@file.site, @file).run
document = Nokogiri::HTML(content)

on lib/record_extractor.rb so that my content is fully rendered.

I understand this is not always the best approach (specially if you don't use Liquid on your content) since it slows the processing and renders more stuff than it's usually needed (headers and footers, etc…)

So I was wondering if you'd accept a PR that would check a setting (something like render_full_page) and render full pages (instead of just the content of each page / post).

Deprecation: Document#tags is now a key in the #data hash.

I apologize if this is already mentioned somewhere (could not find it).

When I run jekyll alogolia push I get hundreds of these:

        Deprecation: Document#tags is now a key in the #data hash.
                     Called by /usr/local/rvm/gems/ruby-2.2.3/gems/algoliasearch-jekyll-0.4.3/lib/record_extractor.rb:53:in `tags'.
        Deprecation: Document#slug is now a key in the #data hash.
                     Called by /usr/local/rvm/gems/ruby-2.2.3/gems/algoliasearch-jekyll-0.4.3/lib/record_extractor.rb:35:in `metadata'.

And it's a bit ugly during my deployment process. Any ideas on what's taking place or if there's anything I can do to mitigate this?

How to add a search cancel button?

Hi there,

I'm using Algolia search for my Jekyll site. And I would like to add a cancel button as soon as a user starts typing text in a search field. Is there any way to do it? I would really appreciate your help.

Feature Request: Add ability to push to any index

Currently one can only push to a single index, set in configuration. This works well if generated indices are similar in nature. However there are some limitations as when the indices are different in content, one cannot leverage multiple sources in autocomplete.js for better styling and separation.

Not sure of the best way to implement it. Maybe let the user set a specific key in return item from custom hook which decides the destination index.
Thanks

Error: API key cannot write to {index_name}_tmp index

I'm trying to integrate Algolia with my Jekyll site by following the instructions here. The instructions say,

Note that your API key should have write access to both the index_name and _tmp suffixed version of it (eg. your_index_name and your_index_name_tmp) in the previous example). This is due to the way we do atomic pushes by pushing to a temporary index and then renaming it.

However, the instructions don't explain how to enable write access to index_name and _tmp. As a result, when I try to push my index, I get this error:

Algolia Error: API key cannot write to {index_name}_tmp index In order to do atomic pushes to your Algolia index, the plugin first pushes to a temporary index (suffixed with _tmp), then renames it.

You see this error because the plugin wasn't able to push to that {index_name}_tmp index, with the API key you provided.

Make sure the API key you're using has rights to write on both your index and its {index_name}_tmp suffixed version.

In my Algolia Dashboard, the Admin API key is the same for both of my indexes (the regular one and the _tmp) one. How do I give my index_tmp write access so that I don't get this error message when pushing my index from the command line?

Search isn't responsive on mobile

The search bar doesn't work on mobile. Well, it works, but you have to manually click out. Enter doesn't close the keyboard and so it makes the interaction really awful.

Reduce the number of entries

Algolia is registering a lot more entries that I have posts. I think that multiple entries are created for a post, based on the number of paragraphs. Is it possible to desactivate paragraph targeting in order to match a post with an object ?

Status of V1

@pixelastic we're about to set up this plugin for a new docs site. Should we use V1 branch? Are you planning to start updating it again soon?

Thank you for your work on this.

Catch errors when zero element indexed

We should catch indexing that index zero results as it is surely an error in the configuration. The error message should indicate pointers as to how to resolve this.

The most common case of empty indexing would be a CSS selector that does not match anything. This can happen when the selector includes elements that are defined in the layouts, as layouts are removed before parsing. The error message should include a note about that.

jekyll algolia push command is not working

Hi there,

I followed your instructions and installed Jekyll Algolia as a gem. But when I try to run $ jekyll algolia push, I get an error:

MacBook-Pro-Svetlana:iloveip svetlana$ jekyll algolia push
Invalid command. Use --help for more information 

How can I fix that?

Plugin not pushing all pages to index

I am running the plugin with the terminal output looking ok 'Indexing of 1306 items' but when I look on the Algolia dashboard it looks to have only indexed 6 pages where it should be around 50

I have tried create a new index, removing any excluded files and using the default settings. I have also looked at the --verbose output and the data is there but not all of it is being pushed up, any ideas what might be causing this?

algoliasearch not registering as a jekyll subcommand

jekyll 3.1.1 and octopress 3.0.11 (not sure if this affects anything)

I followed the steps outlined in the readme however when running jekyll --help the algolia sub command is not listed.

Are there any troubleshooting steps to help with diagnosis or fixing this?

Unable to exclude files from indexing based on directories

I would like to exclude files from being indexed in my Jekyll site based on the directory the files are in. There are too many files in some directories to exclude them one-by-one. I have tried specifying this in my _config.yml file, but it does not seem to work:

algolia:
  excluded_files:
    - index.html
    - calendars/index.html
    - !ruby/regexp "/archive./"

archive is a directory at the root of my Jekyll project, and it contains many files. It would be great to exclude all of the files in archive using some kind of wildcard or regex.

no implicit conversion of nil into Hash

jekyll algoliasearch-jekyll
3.0.1 0.5.3

First, thank you for your hard work on this plugin. It's very much appreciated. Now, for the bug...

The command :

bundle exec jekyll algolia push

produces the error :

jekyll 3.0.1 | Error:  no implicit conversion of nil into Hash

Even if with --verbosemode, I can't manage to produce more info, sorry.

HTTP error: cannot reach any host : execution expired

bundle execute jekyll algolia push returns the following error inside vagrant

[vagrant@vagrant-0-7-0 portal]$ bundle exec jekyll algolia push
Configuration file: /Test/portal/_config.yml
Algolia Error: HTTP Error
Cannot reach any host: execution expired, execution expired, execution expired, execution expired

Update json dependency to v2.0

I'm trying to use both algoliasearch-jekyll and jekyll-webmention_io on my website.

But:

  • algoliasearch-jekyll requires json 1.8
  • jekyll-webmention_io requires json 2.0

I tried to fork algoliasearch-jekyll and on the develop branch update the Gemfile, or even the gemfiles/jekyll_v3.gemfile, but bundle update still tries to use json 1.8 for algoliasearch-jekyll:

Fetching https://github.com/nhoizey/algoliasearch-jekyll.git
Fetching gem metadata from https://rubygems.org/..............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "json":
  In Gemfile:
    json

    algoliasearch-jekyll was resolved to 0.8.0, which depends on
      algoliasearch (~> 1.4) was resolved to 1.14.0, which depends on
        json (>= 1.5.1)

    algoliasearch-jekyll was resolved to 0.8.0, which depends on
      json (~> 1.8)

    jekyll-webmention_io (~> 2.6.1) was resolved to 2.6.1, which depends on
      json (~> 2.0)

I did this on a webmention-gem branch of my site repository.

It looks like I have reached my limits in Ruby…

Cannot install algoliasearch-jekyll

Getting an error when installing "algoliasearch-jekyll"

Ruby 2.3
Jekyll 3.5

gem install algoliasearch-jekyll is causing this error

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_file_s_symlink - (scripts/./watch_v2, D:/ruby/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/scripts/watch)

when running bundle install and adding algoliasearch-jekyll to Gemfile also not working

My Gemfile

source 'https://rubygems.org'

gem 'github-pages'

group :jekyll_plugins do
    gem 'algoliasearch-jekyll', '~> 0.8.2'
    gem 'jekyll-paginate'
    gem 'jekyll-seo-tag'
    gem 'jekyll-feed'
end

gem 'wdm', '>= 0.1.1' if Gem.win_platform?

Also deleted the gemfile.lock then ran bundle install still won't work

Ruby 2.4 compatibility

Looks like this gem depends on json ~> 1.8, which does not support Integer unification, so it cannot be installed on Ruby 2.4.

Algolia push error: "no implicit conversion of nil into Hash"

Jekyll site, stacktrace:

/var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/record_extractor.rb:15:in `merge': no implicit conversion of nil into Hash (TypeError)
	from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/record_extractor.rb:15:in `initialize'
	from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:90:in `new'
	from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:90:in `block in write'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:333:in `block (2 levels) in each_site_file'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:332:in `each'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:332:in `block in each_site_file'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:331:in `each'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:331:in `each_site_file'
	from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/push.rb:87:in `write'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/lib/jekyll/site.rb:75:in `process'
	from /var/lib/gems/2.3.0/gems/algoliasearch-jekyll-0.8.2/lib/algoliasearch-jekyll.rb:33:in `block (3 levels) in init_with_program'
	from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /var/lib/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /var/lib/gems/2.3.0/gems/jekyll-3.5.1/exe/jekyll:13:in `<top (required)>'
	from /usr/local/bin/jekyll:23:in `load'
	from /usr/local/bin/jekyll:23:in `<main>'

Anything else I can provide?

0.6.1 not working with Jekyll 3 or github-pages gem

Using Github pages with Jekyll 3 (3.0.2)

source 'https://rubygems.org'

gem 'github-pages'

group :jekyll_plugins do
  gem 'algoliasearch-jekyll', '~> 0.6.1'
end
$ rm -rf Gemfile.lock
$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.........
Bundler could not find compatible versions for gem "jekyll":
  In Gemfile:
    algoliasearch-jekyll (~> 0.6.1) was resolved to 0.6.1, which depends on
      jekyll (~> 2.5)

    github-pages was resolved to 1, which depends on
      jekyll (= 1.1.2)

source 'https://rubygems.org'

gem 'jekyll', '~> 3.1'

group :jekyll_plugins do
  gem 'algoliasearch-jekyll', '~> 0.6.1'
end
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "jekyll":
  In Gemfile:
    jekyll (~> 3.1)

    algoliasearch-jekyll (~> 0.6.1) was resolved to 0.6.1, which depends on
      jekyll (~> 2.5)

Version 0.6.0 is working fine:

source 'https://rubygems.org'

gem 'github-pages'

group :jekyll_plugins do
  gem 'algoliasearch-jekyll', '~> 0.6.0'
end
$ bundle install
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.........
Using rake 10.5.0
Using RedCloth 4.2.9
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using addressable 2.3.8
Using httpclient 2.7.1
Using bundler 1.11.2
Using thor 0.19.1
Using awesome_print 1.6.1
Using mini_portile2 2.0.0
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using colorator 0.1
Using ffi 1.9.10
Using multipart-post 2.0.0
Using gemoji 2.1.0
Using net-dns 0.8.0
Using public_suffix 1.5.3
Using sass 3.4.21
Using rb-fsevent 0.9.7
Using kramdown 1.9.0
Using liquid 3.0.6
Using mercenary 0.3.5
Using rouge 1.10.1
Using safe_yaml 1.0.4
Using jekyll-feed 0.3.1
Using jekyll-paginate 1.1.0
Using jekyll-sitemap 0.10.0
Using rdiscount 2.1.8
Using redcarpet 3.3.3
Using terminal-table 1.5.2
Using jekyll-textile-converter 0.1.0
Using tzinfo 1.2.2
Using algoliasearch 1.7.0
Using appraisal 2.1.0
Using nokogiri 1.6.7.2
Using coffee-script 2.4.1
Using ethon 0.8.1
Using rb-inotify 0.9.5
Using faraday 0.9.2
Using jekyll-sass-converter 1.3.0
Using activesupport 4.2.5.1
Using algoliasearch-jekyll 0.6.0
Using jekyll-coffeescript 1.0.1
Using typhoeus 0.8.0
Using listen 3.0.5
Using sawyer 0.6.0
Using html-pipeline 2.3.0
Using github-pages-health-check 0.6.0
Using jekyll-watch 1.3.1
Using octokit 4.2.0
Using jekyll 3.0.2
Using jekyll-gist 1.4.0
Using jekyll-mentions 1.0.0
Using jekyll-redirect-from 0.9.1
Using jekyll-seo-tag 0.1.4
Using jemoji 0.5.1
Using github-pages 45
Bundle complete! 2 Gemfile dependencies, 60 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

algolia selector returning undefined

Hi, I'm using Algolia search for my blog, and for some reason the algolia selector is always returning undefined, and I can't seem to figure out why. The site is here and the source code is here. I'm using the js from jekyll-algolia-hyde with a slight modification. Thanks!

Remove Algolia anchors in the URL

Hello,

I'm trying to configure Algolia search. When I get search results for a query the url looks like this: /kb/summary/#algolia:p:nth-of-type(8). Is this an intended behavior? How can I remove this anchor from the url and link simply to a page?

How to change the format of the date for search results.

I would like to change the format of the date for search results. Now it is shown as "two days ago", etc. But I need to have the date in the following format: %Y-%m-%d (for example 2015-11-01). Because then I translate it into Russian using Liquid, as described here.

How can I do it?

No subcommand "algolia"

Hi

I followed the procedure from the readme (including the Gemfile, bundle install, ...) but when running jekyll help, I can't find the algolia subcommand

Any idea how to debug this ?

Ease the front-end integration

It would greatly help adoption if the plugin had a front-end library to easily drop in any Jekyll theme.

Basically it would need a CSS selector to target the input that will be used as the search box. And a choice of either displaying results in a dropdown (then loading autocomplete.js), or on a full page text (loading a custom script).

For the full page text, I'll also need to let users define an HTML element that will be replaced with results when a search is started.

Several Algolia search inputs on one site are not working

Hi there,

I have one more question. I have different menu for mobile and desktop versions of the site. I've implemented Algolia search in mobile menu, which is not displayed by default. On a desktop version I would like to have Algolia search in a separate page like search.html. But when I add Algolia search input to this page, it's not working (the results are not showing).

Is it possible to have several Algolia search inputs on one site?

Zlib missing

Hello i'm a noob on ruby and i try to install gem algoliasearch-jekyll with command line like this and i have this issue

waratah@waratah-MS-7519:~$ sudo gem install algoliasearch-jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing algoliasearch-jekyll:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.9.1
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build


Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

How can i fix it ?
Thx

Enhancement: Using the new facetingAfterDistinct=true for correct facet count

The API now accept an facetingAfterDistinct=true that does the count of facets after the distinct (default is to do it before). Without this option, the count for facets when doing a distinct was "wrong" (ie. it did not take the distinct into account, returning way higher count that what was visible).

This option allow to fix this issue, but come with a performance counterpart on big indices. I think it's safe to set it as default for Jekyll blogs.

Jekyll Push Consumes Too Much Operations

I am using an Algolia Hacker plan and using Travis to build my Jekyll site. The site will get rebuild whenever there is a new post which happens multiple times a day.

Currently, my site has around 300+ posts which mean every time Travis build the site and invoke Jekyll algolia push it will consume at least 300+ operations.

My question is, is there a way to delta update the index instead of whole update index all over again? So that I can save some operations for real search and not waste so many operations on re-index preexist stuff.

Gem::Specification.load returning nil

In version 0.4.2 I've encountered this error:

updating algolia index
/Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.4.2/lib/push.rb:129:in `set_user_agent_header': undefined method `version' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.4.2/lib/push.rb:135:in `create_index'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.4.2/lib/push.rb:163:in `push'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.4.2/lib/push.rb:94:in `write'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:53:in `process'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.4.2/lib/algoliasearch-jekyll.rb:32:in `block (3 levels) in init_with_program'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /usr/bin/jekyll:23:in `load'
    from /usr/bin/jekyll:23:in `<main>'

Could be same issue as this one in rubygems: rubygems/rubygems#1287

When I overwrite version in push.rb to string, it works.

Asciidoc files don't get indexed

Jekyll supports file types beyond markdown and HTML via extensions like jekyll-asciidoc, but there is currently no way to make algoliasearch-jekyll index these. I've submitted #60 to fix this.

Exclude div classes from index

Hello,

I have a question. Is there any way to exclude certain html elements from index? For example, certain div and p classes?

Also, how can I limit the number of words in search results?

Thank you very much in advance!

`block in weight': undefined method `split' for nil:NilClass

Just encountered this error when running jekyll algolia push

_config.yml:

algolia:
  application_id: ''
  index_name: ''

https://github.com/algolia/algoliasearch-jekyll/blob/master/lib/record_extractor.rb#L150

updating algolia index
/Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:150:in `block in weight': undefined method `split' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:150:in `map'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:150:in `weight'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:174:in `block in extract'
    from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
    from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
    from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:162:in `each_with_index'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/record_extractor.rb:162:in `extract'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/push.rb:59:in `block in write'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:477:in `block (2 levels) in each_site_file'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:476:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:476:in `block in each_site_file'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:475:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:475:in `each_site_file'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/push.rb:56:in `write'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:53:in `process'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/push.rb:69:in `process'
    from /Library/Ruby/Gems/2.0.0/gems/algoliasearch-jekyll-0.2.1/lib/algoliasearch-jekyll.rb:24:in `block (3 levels) in init_with_program'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
    from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
    from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /usr/bin/jekyll:23:in `load'
    from /usr/bin/jekyll:23:in `<main>'

Errors: Make a more explicit error message for big records

When currently trying to push a record over the limit, the user is greeted with

Algolia Error: HTTP Error
Cannot POST to https://APPID.algolia.net/1/indexes/index_tmp/batch: {"message":"Record is too big size=123992 bytes. Contact us if you need an extended quota","status":400} (400)

Could be nice to catch the error and provide an explanation and work-arounds.

Unable to index, the task says it can find Jekyll

When I run this command:

ALGOLIA_API_KEY='abcdefgh…' bundle exec jekyll algolia push --config _config.yml,_config_credentials.yml

I get the attached console messages: algolia.txt

The Youtube and Vimeo lines come from another plugin, when building the site.

The interesting part starts with these lines:

Indexing 1000 items
bundler: failed to load command: jekyll (/usr/local/bin/jekyll)
SystemStackError: stack level too deep
  /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext/object/json.rb:161:in `initialize_dup'
  /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext/object/json.rb:161:in `dup'
…

Then, almost 1000 lines later:

…
  /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/json/encoding.rb:33:in `encode'
  /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/json/encoding.rb:20:in `encode'
  /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/core_ext/object/json.rb:37:in `to_json'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-1.10.0/lib/algolia/index.rb:548:in `batch'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-1.10.0/lib/algolia/index.rb:64:in `add_objects'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-1.10.0/lib/algolia/index.rb:72:in `add_objects!'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:170:in `block in batch_add_items'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:167:in `each'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:167:in `each_slice'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:167:in `batch_add_items'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:187:in `push'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/push.rb:96:in `write'
  /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.1.6/lib/jekyll/site.rb:61:in `process'
  /usr/local/lib/ruby/gems/2.3.0/gems/algoliasearch-jekyll-0.8.0/lib/algoliasearch-jekyll.rb:33:in `block (3 levels) in init_with_program'
  /usr/local/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /usr/local/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /usr/local/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /usr/local/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /usr/local/lib/ruby/gems/2.3.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.1.6/bin/jekyll:13:in `<top (required)>'
  /usr/local/bin/jekyll:22:in `load'
  /usr/local/bin/jekyll:22:in `<top (required)>'

I can run bundle exec jekyll build to build the site, so I don't understand why the algolia task is not able to run jekyll.

Nokogiri Error

When running bundle exec jekyll algolia push on Jekyll version 3.5.1 I get an error: Error: undefined method 'parent' for #<Nokogiri::HTML::Document:0x007f8aabde5fc0>.

I'm running Ruby version 2.3.0. Any ideas? Or anyone else experiencing this issue?

Thanks!

Add support for API write key in a config file

I use several Jekyll plugins that take API keys from a config file instead of environment variables. Not the default _config.yml, which is often tracked in the versioning system, but another that is not tracked.

I have a _config_credentials.yml file for example, and I run Jekyll commands like this:

bundle exec jekyll build --config _config.yml,_config_credentials.yml

Would this be possible here?

Push to tmp index causes failure with index restriction for API key

My first steps combining jekyll with algolia resulted in the following error message:

Cannot PUT to https://E7UT30N10W.algolia.net/1/indexes/glaubenskurs.bonifati.us_tmp/settings: {"message":"Invalid Application-ID or API key","status":403}

When I tried to put some settings with curl there was no problem, neither with directly using the ruby lib. Only after replaying the exact same requests with curl I figured that my API key simply has no access to the temporary index "#{index_name}_tmp" which is automatically used by this gem. My solution was to manually create the temporary index and issue a new API key with access to both the main and temporary indices (using a wildcard should also be possible).

This is of course not an issue for unrestricted API keys. But when you want to restrict your API key to specific indices, this behaviour requires some special attention.
I'd suggest to put a notice in the README and maybe provide a error message with a hint in case index.set_settings fails with a 403.

Error: undefined method `text' for nil:NilClass

I have been constantly getting this error, whereas jekyll build works without any errors.

Extracting data from reference/03.reference-request/index.html
jekyll 2.5.3 | Error:  undefined method `text' for nil:NilClass

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.