KitaitiMakoto / epub-search

EPUB search tool
MIT License
4 stars 1 forks source link

displaying results in rails application #2

Open Louvivien opened 5 years ago

Louvivien commented 5 years ago

Hi,

When i try to display results in a rails app online this is what i get 👍

ActionView::Template::Error (invalid argument: [table][create] db not initialized: #<Groonga::Hash id: <2147483651>, name: (anonymous), path: (temporary), domain: (256), range: (nil), flags: , size: <4>, encoding: <:utf8>, default_tokenizer: (nil), token_filters: [], normalizer: (nil)> db.c:1078: grn_table_create_with_max_n_subrecs()):

def index() color=$stdout.tty? highlight = [true, 'always'].include? color highlight = $stdout.tty? if color == 'auto' @db = EPUB::Search::Database.new('./lib/epub-search/db') @word = "condition"

@result = @db.search @word do |result|
  EPUB::Search::Formatter::CLI.new(result, @word, highlight).format
                    end      
         end

this is what I have un my index controller.

Do you know how i can fix this, display and format the results in a web application ?

KitaitiMakoto commented 5 years ago

Hi, @Louvivien .

Thank you for use of my gem!

If you haven't created database directories and files yet, can you try

EPUB::Search::Database.new('./lib/epub-search/db').init

This method creates database directories and files to save and search from words.