groonga-client-rails 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/doc/text/news.md +9 -0
- data/groonga-client-rails.gemspec +1 -1
- data/lib/groonga/client/rails/spec_helper.rb +6 -8
- data/lib/groonga/client/rails/test_helper.rb +11 -8
- data/lib/groonga/client/rails/test_synchronizer.rb +17 -0
- data/lib/groonga/client/rails/version.rb +1 -1
- data/lib/groonga/client/searcher/select_request.rb +63 -0
- data/lib/groonga/client/searcher.rb +3 -3
- data/test/apps/rails4-mongoid/Gemfile +1 -0
- data/test/apps/rails4-mongoid/Gemfile.lock +53 -47
- data/test/apps/rails4-mongoid/log/test.log +5338 -0
- data/test/apps/rails5-activerecord/Gemfile +52 -0
- data/test/apps/rails5-activerecord/Gemfile.lock +205 -0
- data/test/apps/rails5-activerecord/README.md +24 -0
- data/test/apps/rails5-activerecord/Rakefile +6 -0
- data/test/apps/rails5-activerecord/app/assets/config/manifest.js +3 -0
- data/test/apps/rails5-activerecord/app/assets/javascripts/application.js +16 -0
- data/test/apps/rails5-activerecord/app/assets/javascripts/cable.js +13 -0
- data/test/apps/rails5-activerecord/app/assets/javascripts/posts.coffee +3 -0
- data/test/apps/rails5-activerecord/app/assets/stylesheets/application.css +15 -0
- data/test/apps/rails5-activerecord/app/assets/stylesheets/posts.scss +7 -0
- data/test/apps/rails5-activerecord/app/assets/stylesheets/scaffolds.scss +89 -0
- data/test/apps/rails5-activerecord/app/channels/application_cable/channel.rb +4 -0
- data/test/apps/rails5-activerecord/app/channels/application_cable/connection.rb +4 -0
- data/test/apps/rails5-activerecord/app/controllers/application_controller.rb +3 -0
- data/test/apps/rails5-activerecord/app/controllers/posts_controller.rb +90 -0
- data/test/apps/rails5-activerecord/app/helpers/application_helper.rb +2 -0
- data/test/apps/rails5-activerecord/app/helpers/posts_helper.rb +2 -0
- data/test/apps/rails5-activerecord/app/jobs/application_job.rb +2 -0
- data/test/apps/rails5-activerecord/app/mailers/application_mailer.rb +4 -0
- data/test/apps/rails5-activerecord/app/models/application_record.rb +3 -0
- data/test/apps/rails5-activerecord/app/models/post.rb +7 -0
- data/test/apps/rails5-activerecord/app/searchers/application_searcher.rb +2 -0
- data/test/apps/rails5-activerecord/app/searchers/posts_searcher.rb +16 -0
- data/test/apps/rails5-activerecord/app/views/layouts/application.html.erb +14 -0
- data/test/apps/rails5-activerecord/app/views/layouts/mailer.html.erb +13 -0
- data/test/apps/rails5-activerecord/app/views/layouts/mailer.text.erb +1 -0
- data/test/apps/rails5-activerecord/app/views/posts/_form.html.erb +27 -0
- data/test/apps/rails5-activerecord/app/views/posts/_post.json.jbuilder +2 -0
- data/test/apps/rails5-activerecord/app/views/posts/edit.html.erb +6 -0
- data/test/apps/rails5-activerecord/app/views/posts/index.html.erb +45 -0
- data/test/apps/rails5-activerecord/app/views/posts/index.json.jbuilder +1 -0
- data/test/apps/rails5-activerecord/app/views/posts/new.html.erb +5 -0
- data/test/apps/rails5-activerecord/app/views/posts/show.html.erb +14 -0
- data/test/apps/rails5-activerecord/app/views/posts/show.json.jbuilder +1 -0
- data/test/apps/rails5-activerecord/bin/bundle +3 -0
- data/test/apps/rails5-activerecord/bin/rails +9 -0
- data/test/apps/rails5-activerecord/bin/rake +9 -0
- data/test/apps/rails5-activerecord/bin/setup +34 -0
- data/test/apps/rails5-activerecord/bin/spring +16 -0
- data/test/apps/rails5-activerecord/bin/update +29 -0
- data/test/apps/rails5-activerecord/config/application.rb +15 -0
- data/test/apps/rails5-activerecord/config/boot.rb +3 -0
- data/test/apps/rails5-activerecord/config/cable.yml +9 -0
- data/test/apps/rails5-activerecord/config/database.yml +25 -0
- data/test/apps/rails5-activerecord/config/environment.rb +5 -0
- data/test/apps/rails5-activerecord/config/environments/development.rb +54 -0
- data/test/apps/rails5-activerecord/config/environments/production.rb +86 -0
- data/test/apps/rails5-activerecord/config/environments/test.rb +42 -0
- data/test/apps/rails5-activerecord/config/groonga_client.yml +22 -0
- data/test/apps/rails5-activerecord/config/initializers/application_controller_renderer.rb +6 -0
- data/test/apps/rails5-activerecord/config/initializers/assets.rb +11 -0
- data/test/apps/rails5-activerecord/config/initializers/backtrace_silencers.rb +7 -0
- data/test/apps/rails5-activerecord/config/initializers/cookies_serializer.rb +5 -0
- data/test/apps/rails5-activerecord/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/apps/rails5-activerecord/config/initializers/inflections.rb +16 -0
- data/test/apps/rails5-activerecord/config/initializers/mime_types.rb +4 -0
- data/test/apps/rails5-activerecord/config/initializers/new_framework_defaults.rb +24 -0
- data/test/apps/rails5-activerecord/config/initializers/session_store.rb +3 -0
- data/test/apps/rails5-activerecord/config/initializers/wrap_parameters.rb +14 -0
- data/test/apps/rails5-activerecord/config/locales/en.yml +23 -0
- data/test/apps/rails5-activerecord/config/puma.rb +47 -0
- data/test/apps/rails5-activerecord/config/routes.rb +4 -0
- data/test/apps/rails5-activerecord/config/secrets.yml +22 -0
- data/test/apps/rails5-activerecord/config/spring.rb +6 -0
- data/test/apps/rails5-activerecord/config.ru +5 -0
- data/test/apps/rails5-activerecord/db/development.sqlite3 +0 -0
- data/test/apps/rails5-activerecord/db/migrate/20161212004726_create_posts.rb +10 -0
- data/test/apps/rails5-activerecord/db/schema.rb +22 -0
- data/test/apps/rails5-activerecord/db/seeds.rb +7 -0
- data/test/apps/rails5-activerecord/db/test.sqlite3 +0 -0
- data/test/apps/rails5-activerecord/log/development.log +808 -0
- data/test/apps/rails5-activerecord/log/test.log +1137 -0
- data/test/apps/rails5-activerecord/public/404.html +67 -0
- data/test/apps/rails5-activerecord/public/422.html +67 -0
- data/test/apps/rails5-activerecord/public/500.html +66 -0
- data/test/apps/rails5-activerecord/public/apple-touch-icon-precomposed.png +0 -0
- data/test/apps/rails5-activerecord/public/apple-touch-icon.png +0 -0
- data/test/apps/rails5-activerecord/public/favicon.ico +0 -0
- data/test/apps/rails5-activerecord/public/robots.txt +5 -0
- data/test/apps/rails5-activerecord/test/controllers/posts_controller_test.rb +50 -0
- data/test/apps/rails5-activerecord/test/fixtures/posts.yml +9 -0
- data/test/apps/rails5-activerecord/test/models/post_test.rb +7 -0
- data/test/apps/rails5-activerecord/test/searchers/posts_searcher_test.rb +120 -0
- data/test/apps/rails5-activerecord/test/test_helper.rb +11 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/04/04zh1ytKDagWzWcqUyadXtzzohCn9iVvSVG4KrjpfPU.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/0M/0M4bZ4tQh0MQYZMb72U5yr-ELStAsUSb8akkTME9TPM.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/0g/0gB1rYz79RuAa43DzVci1GUjc5so0F1dU_LyLSmm3oQ.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/1w/1w3lEnPL9oZPD-uk9Y9HOAO5TBywbDUumPsLKAD1trs.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/2g/2gve43APDqh4mVsNSvvDZWU7XBUFJ22DjchDFC7BLHE.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/3F/3Fsw9a9YyB3-WaDSpA1HTGJrWn_7xMLLpUYcNv4f4zs.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/3P/3Px3lDIUtsiFfGy4nQGown3yldwKCp1MNuWbSDX1pvg.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/4z/4zN1uyLrntkJkbS2fdatLGK7KyyLUl2uufUks7wTDjQ.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/6C/6CiFiBprKrfOQZWs4gi3u2dD5mFuRjvrvkBi6BdwwMo.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/6a/6ae9A4LxsOF8WxXqTRrY_OfmiKLzuX-k8CdxcYhyH2w.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/6g/6gfb-nNauXmim2itNUscPWKLGmjzBgnE4ee76bNftS4.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/6n/6n_6crFw4ICv3THdmoHgXfEXbykmN_3Qh0M3Y7BYoPA.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/6r/6rrJLZY0-_gdJxgMUZBZIn-wf8bPVArYjXhIIrt_O5Y.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/7-/7-Zu1JSO2hqoAENLcGCtMh1TuhXyUjvzDCR1BAU-whs.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/7G/7GXxgDjc3_xi8wt4fJkmv_XE9W19LHgDDmJIOJL8B8E.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/7X/7XEN3CPn0h-3vjvFpHuvqByvBbmKNG0WgmdvlCrHmI8.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/7l/7lu9duHmsh9ktTH4DbSPnN7p_Xz59VwGcX2J8XDP66Q.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/7u/7uFy7yq8C8xezFbAvr8RzLaJRyEY34DlqcIsygk5u48.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/8Z/8Zm1d9-lBPsGG_HUw8FP2OCCVucGDVhWAOGaopvOdss.cache +3 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/9p/9pkKAqd_Ia0HpbbUCZtpJ8WiDzr5stcFJsnqsOsJwCc.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/9w/9w_czK8Y6L_1dHF-b-aFykWLeiPmTlnI_vTHsNG1Mow.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/B9/B9QeeLv4GR9sOdrwyvxa8jIr4MkxjYh4Ow6MOZ8slX8.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/BK/BKtHbqHUW-BUh6yXbZoSBLGYZdH4xpyEVJZ85mre3dI.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Bn/BnqImgz8w0eyrrFRDbwQXdI6oPEBaakRHuxqdDfCA6g.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Bx/BxzoG0KxeNLac4xTNeJv3qfeytbNBw58xj2zD-xdbrE.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/DG/DGB9_ZZc6xf8xDs1C8MTwsnZGITqTg5w6Fi8loIoAz0.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/DI/DIQbAB3xoMpwIuVisoyQuLOOLReZGqTzMsMSqPTvNlU.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/DY/DYQB1uQOZWEQCZyNqRYGbp3TUGnhwGln6l0LJxvfdSM.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Dw/DwMpASR_zMhZCB0WD5ibeEaOAEhod-gPDA-cl83A0NQ.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Fp/FpDNzaN6X2qtiDvQrm2u2kFkPCkFxqjQWh8FcB2wcow.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Fu/FuDP2r9jXh_VnQRBnJO9wYbxDUivFdL1tVpdpp3GUgQ.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/G0/G0kukI-r0q0Vbrg6e_jnYJoYcOX8K__h-mwKbCf4twE.cache +2 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/H4/H4qMae4wP-2E0IT3OzIKJm7TAmkfgTg5GG-mDvrpRr8.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/H8/H84Co5MLW6jHqkSepLLZXA99CN3Pj4Orn146jUdB-7Q.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/HJ/HJmxnxAVu4ESMb2RUFATQhzd8xP7qwk0i7Or2WU6tHY.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/I4/I4vFFlIVkL7O3GA9sTW-w6J6yRUCLLl9YNRmfxrqswI.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/IM/IMjPkcjxzZVEDA07aU4zncnyk1cKAnqE0QWlQ05eF_I.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/IX/IXa4w4VzXhmtd6DpleMPZTaZo-ak-2VW39_rTlS_82A.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Mw/MwUXpv2ArJcHhHfRN-i_SHhOyrhE2ED5DP6j2_tHtDM.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/N6/N6_UDcd-9vm063oO9Kj2UKERXHyG53mpljIHhMP_sX0.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/O_/O_d1EuhZnMhlM56iFmcx1Yr-tKS2-F8XK2Ck4thkxfw.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Oa/Oapw1N5wZtnRU54bGH1T0T5WvFHcAO8pp8RiEBPvgio.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Oj/OjcwYv10xeNyxU4ma4rSL7scLtN1VSqgQtpmLAkKa1s.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Ou/Ouwd1f-B-Ub4MsspZT6taABsir9tZQ3Lgk0Yqv0cxYE.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/QT/QTeyXBrKqJWoMRN63_SDKm0DCFLsggXpmWSa1om_1lI.cache +2 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Qf/Qff9sy3RsADWqwgXy563eZw2BMxHil52FiOxDmKQnn4.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Qw/QwtseSptjk29vLQAs9XVSY_9GY6mR4wLQ6e3xJZzwuo.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Rf/RfAETGxupO0E6Sf50S9Rs_7H_8IFQkZ0V_Ot0qRcMaM.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Sh/ShN-ZUpoxLJLJiMV5gFDP00vcSMHw87YzFBlXH4adPA.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Si/Sin6bEoASrNa45108CpfgF2jcifz-KpbsvvZJtqVZ68.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Ss/SsUxWtOAxDX66Ss49rvswWEE6LOPrbBTnxaY9OJWizk.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Uw/Uws4qYyGLobvE_JD4L6dQNcIOOhv4LEZ3D0mK86tZOA.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Vt/VtVyxYXmlAEeORF9LOH-DbqhYCV0kSXXBINi9BY3snA.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Wm/WmtvDDxglSnhmavMeA7WNn7waN3QbagRHeoZHvZJN84.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/X6/X6u2Cul1j8SpBq0WC1S8WhzGiT6f-6L_djUngh_gQfw.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/XJ/XJRPx7aZ4ajZ72O37hx53ZFkfXSHpDDpCy78LI0leqM.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/XL/XLmhbBwmjyGt7wnSpdFhJl1d66h1gXmGMr2IKRsPlKY.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Ya/YayMISAqD-Y3vBFywwKrXbUovGf5o77HUF5s8mnQgO0.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Zj/ZjPZKMxS8BzA1QxHFURXSpprFItP8iIYNCg6yfbO69Y.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/Zp/Zpsgmz0pdcpEUMODH-KOoEAJu0RLiNBG5_id1Nf4Vro.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/_G/_GwD5pS-87WWo17f6dUcFYGFT8h6uDWR6QdHajFQ050.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/aa/aaHS7n54GBP_AiELufudftqA7C4tZhFBH9VGYdybJr8.cache +2 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/aq/aqjR2hhB4hrgzOzUkhuiAL1DPqVmVI4OsnJb8KyCpRI.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/bS/bS7RTBMfq7yErvNUrJroVgliHjy91XOcgiXzD50OvvQ.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/c9/c9YydpmE9rI8VeQ4sVqd5JrA1VSEFGGzpuMBUSrAGac.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/de/dep71WPFUs1sHIqTVNqe1rFl1LFWoNyCEoVy0n6nTTg.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/eQ/eQxzX_D16-XyOt1WTkYEC0qDvRbjXcCgQgnd9pBrg7o.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/fs/fsOGJq1Cf6bkAY-rQw_0-E3_SR3wCq32URYNGrkpra8.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/gF/gFlNnL_JJ9wEwdiM694Q0NJO7dBi7x3O2kyUIIZOydY.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/gu/guDotVUAVpm_e8AAnaLB25fL5q9nVvbnd5DFP2BxmAQ.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/h3/h3iZNjBA2CDMexgKNJ4fSFfDiZ_37c72HncCttwZ4q0.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/he/heptoj4xFW23bqbGAnQ2g6MsS3OKgswQZOu4EFQA9CE.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/kN/kNQUVmgZpBoZh9oC57J3qRmnvFOb8zfDeJWar6cPJFM.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/km/km1UJe7Uvz3cE03ctzec3Mpcow_vgKO36rq50_Szy3o.cache +5 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/kz/kzw210ITXFWNFV8kw5e-_kRlpS48lGotSQWKPlUfMJ4.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/ml/mlRB5mvsqzeYz3r37_UHdnW4NOillPXmunrGdwZYTHA.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/oU/oU63Z9l_0IaXAW3TtHWxMULUMeuVLfhm4JTQmjJZrWU.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/p8/p8ScAOn0EywLQE0ZoyA5zwrJlr4BIt67RbiYm8jsJMY.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/pH/pHU4zRTrCWZeiDw5r9Sx1F_edVOO_yCGQXumtTI04to.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/pI/pImLE-1HdM_Pm_YDztsV-98V1_qngUx98EVI_90rD0I.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/pb/pb0V-IHbOTzmTuDDHO7dn8kl3G4RWqXYY1-Gtuklh-M.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/q9/q9zC8RrLhOO1dVXJ3fZqc9dSbshhjSpsDQxh5MpbnDA.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/rF/rF2vahiCQKUhJ8McEG0p8B7csWsz-dL13EQ7r2APOxc.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/rn/rnjUJtM3qyEybb7S3NaVbV36OvY6ulGzqxgvp6vtkW0.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/s8/s85RambnXGg0AXRuWcCg0nv0_yQuuimoB-efYJZXR_g.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/sS/sSg6UsW5PPi591GTK35btFew1r3_HpbNHoyZv3vZ_HY.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/sW/sWkhnUHFHtFl9YPE6ipfrFL8zC0XPcgjPpwKYIiLGmQ.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/s_/s_Kwboiht6NBnTgNZxLOjhdTdW5OETSG1i9v_nYwTbg.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/sk/skhQpKGMHfNuU9HmJ5SsawJxYVAfktwxv24N4uNMrfc.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/t3/t39F_1zIFMdWiKVUNJyhWOOnP8Lgr6AD5R1HWdVYwbU.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/t_/t_jrBzlnaAwG3v7X5kQsHXmVKIL167gvY-CegXdW-38.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/wq/wq2DrniT-R28eVCkWJ2LyZjvT8phxRe31mas90YVz2M.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/x7/x7PYh8DJvPykcEqpVab2vcY9-GFz-3cqtoMlRAu94Uc.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/yO/yO6BxW_KpdFMPjQgywUZXxLvdVM639GnboZKUb3K7kA.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/yj/yjqd7Lagqg4Ar_2z5oQo--OO15mhsi97lixJZbk_xrw.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/z6/z6juZG91PfdGTEhEife_MlutAwyoheFYa52JtbCUvBM.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/zh/zhmfmdnnow0QqwfT_7IXfN-FAU8qAMm03N7XQjFct6E.cache +1 -0
- data/test/apps/rails5-activerecord/tmp/cache/assets/sprockets/v3.0/zz/zzyY0k_acKQ2rB0GJcjv6jioH5c2iq-jMM_qIhbfdnI.cache +0 -0
- data/test/apps/rails5-activerecord/tmp/pids/server.pid +1 -0
- data/test/apps/rails5-activerecord/tmp/restart.txt +0 -0
- metadata +381 -21
- data/lib/groonga/client/rails/fixture.rb +0 -35
- data/lib/groonga/client/rails/groonga_server_runner.rb +0 -164
- data/lib/groonga/client/searcher/error.rb +0 -37
- data/lib/groonga/client/searcher/raw_request.rb +0 -85
- data/lib/groonga/client/searcher/select/request.rb +0 -283
- data/lib/groonga/client/searcher/select/result_set.rb +0 -117
- data/lib/groonga/client/searcher/select.rb +0 -18
- data/test/unit/searcher/select/filter_parameter_test.rb +0 -99
- data/test/unit/searcher/select/match_columns_parameter_test.rb +0 -59
- data/test/unit/searcher/select/output_columns_parameter_test.rb +0 -68
- data/test/unit/searcher/select/sortby_parameter_test.rb +0 -63
@@ -1,164 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
require "rbconfig"
|
18
|
-
require "fileutils"
|
19
|
-
|
20
|
-
module Groonga
|
21
|
-
class Client
|
22
|
-
module Rails
|
23
|
-
class GroongaServerRunner
|
24
|
-
def initialize
|
25
|
-
@pid = nil
|
26
|
-
@using_running_server = false
|
27
|
-
@url = build_url
|
28
|
-
@groonga = find_groonga
|
29
|
-
@tmp_dir = nil
|
30
|
-
end
|
31
|
-
|
32
|
-
def run
|
33
|
-
if groonga_server_running?
|
34
|
-
@using_running_server = true
|
35
|
-
else
|
36
|
-
return if @groonga.nil?
|
37
|
-
@tmp_dir = create_tmp_dir
|
38
|
-
db_path = @tmp_dir + "db"
|
39
|
-
@pid = spawn(@groonga,
|
40
|
-
"--port", @url.port.to_s,
|
41
|
-
"--log-path", (@tmp_dir + "groonga.log").to_s,
|
42
|
-
"--query-log-path", (@tmp_dir + "query.log").to_s,
|
43
|
-
"--protocol", "http",
|
44
|
-
"-s",
|
45
|
-
"-n", db_path.to_s)
|
46
|
-
wait_groonga_ready
|
47
|
-
end
|
48
|
-
sync_schema
|
49
|
-
end
|
50
|
-
|
51
|
-
def stop
|
52
|
-
if @using_running_server
|
53
|
-
Groonga::Client.open do |client|
|
54
|
-
schema = client.schema
|
55
|
-
schema.tables.each do |name, _|
|
56
|
-
client.delete(table: name,
|
57
|
-
filter: "true")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
else
|
61
|
-
if @pid
|
62
|
-
Groonga::Client.open do |client|
|
63
|
-
client.shutdown
|
64
|
-
end
|
65
|
-
wait_groonga_shutdown
|
66
|
-
end
|
67
|
-
if @tmp_dir
|
68
|
-
FileUtils.rm_rf(@tmp_dir)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
def build_url
|
75
|
-
default_options = Groonga::Client.default_options
|
76
|
-
url = default_options[:url]
|
77
|
-
if url.nil?
|
78
|
-
host = default_options[:host] || default_options[:address]
|
79
|
-
port = default_options[:port] || 10041
|
80
|
-
path = default_options[:path]
|
81
|
-
url = URI("http://#{host}:#{port}#{path}")
|
82
|
-
end
|
83
|
-
url
|
84
|
-
end
|
85
|
-
|
86
|
-
def groonga_server_running?
|
87
|
-
begin
|
88
|
-
TCPSocket.open(@url.host, @url.port) do
|
89
|
-
end
|
90
|
-
rescue SystemCallError
|
91
|
-
false
|
92
|
-
else
|
93
|
-
true
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def sync_schema
|
98
|
-
::Rails.application.eager_load!
|
99
|
-
ObjectSpace.each_object(Class) do |klass|
|
100
|
-
klass.sync_schema if klass < Searcher
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def find_groonga
|
105
|
-
paths = ENV["PATH"].split(File::PATH_SEPARATOR)
|
106
|
-
exeext = RbConfig::CONFIG["EXEEXT"]
|
107
|
-
paths.each do |path|
|
108
|
-
groonga = File.join(path, "groonga#{exeext}")
|
109
|
-
return groonga if File.executable?(groonga)
|
110
|
-
end
|
111
|
-
nil
|
112
|
-
end
|
113
|
-
|
114
|
-
def create_tmp_dir
|
115
|
-
tmpfs_dir = "/dev/shm"
|
116
|
-
if File.directory?(tmpfs_dir)
|
117
|
-
base_tmp_dir = Pathname(tmpfs_dir)
|
118
|
-
else
|
119
|
-
base_tmp_dir = ::Rails.root + "tmp"
|
120
|
-
end
|
121
|
-
tmp_dir = base_tmp_dir + "groonga-client-rails.#{Process.pid}"
|
122
|
-
FileUtils.rm_rf(tmp_dir)
|
123
|
-
FileUtils.mkdir_p(tmp_dir)
|
124
|
-
tmp_dir
|
125
|
-
end
|
126
|
-
|
127
|
-
def wait_groonga_ready
|
128
|
-
n_retried = 0
|
129
|
-
while n_retried <= 20
|
130
|
-
n_retried += 1
|
131
|
-
sleep(0.05)
|
132
|
-
if groonga_server_running?
|
133
|
-
break
|
134
|
-
else
|
135
|
-
begin
|
136
|
-
pid = Process.waitpid(@pid, Process::WNOHANG)
|
137
|
-
rescue SystemCallError
|
138
|
-
@pid = nil
|
139
|
-
break
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def wait_groonga_shutdown
|
146
|
-
# TODO: Remove me when Groonga 6.0.1 has been released.
|
147
|
-
# Workaround to shutdown as soon as possible.
|
148
|
-
groonga_server_running?
|
149
|
-
|
150
|
-
n_retried = 0
|
151
|
-
while n_retried <= 20
|
152
|
-
n_retried += 1
|
153
|
-
sleep(0.05)
|
154
|
-
pid = Process.waitpid(@pid, Process::WNOHANG)
|
155
|
-
return if pid
|
156
|
-
end
|
157
|
-
|
158
|
-
Process.kill(:KILL, @pid)
|
159
|
-
Process.waitpid(@pid)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
module Groonga
|
18
|
-
class Client
|
19
|
-
class Searcher
|
20
|
-
class Error < Client::Error
|
21
|
-
end
|
22
|
-
|
23
|
-
class ErrorResponse < Error
|
24
|
-
attr_reader :response
|
25
|
-
def initialize(response)
|
26
|
-
@response = response
|
27
|
-
command = @response.command
|
28
|
-
status_code = @response.status_code
|
29
|
-
error_message = @response.error_message
|
30
|
-
message = "failed to execute: #{command.name}: #{status_code}: "
|
31
|
-
message << "<#{error_message}>"
|
32
|
-
super(message)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
module Groonga
|
18
|
-
class Client
|
19
|
-
class Searcher
|
20
|
-
class RawRequest
|
21
|
-
def initialize(command_name, parameters=nil)
|
22
|
-
@command_name = command_name
|
23
|
-
@parameters = parameters
|
24
|
-
end
|
25
|
-
|
26
|
-
def response
|
27
|
-
@reponse ||= Client.open do |client|
|
28
|
-
response = client.execute(@command_name, to_parameters)
|
29
|
-
raise ErrorResponse.new(response) unless response.success?
|
30
|
-
response
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def parameter(name, value)
|
35
|
-
add_parameter(OverwriteMerger,
|
36
|
-
RequestParameter.new(name, value))
|
37
|
-
end
|
38
|
-
|
39
|
-
def to_parameters
|
40
|
-
if @parameters.nil?
|
41
|
-
{}
|
42
|
-
else
|
43
|
-
@parameters.to_parameters
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
def add_parameter(merger_class, parameter)
|
49
|
-
merger = merger_class.new(@parameters, parameter)
|
50
|
-
create_request(merger)
|
51
|
-
end
|
52
|
-
|
53
|
-
def create_request(parameters)
|
54
|
-
self.class.new(@command_name, parameters)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class RequestParameter
|
59
|
-
def initialize(name, value)
|
60
|
-
@name = name
|
61
|
-
@value = value
|
62
|
-
end
|
63
|
-
|
64
|
-
def to_parameters
|
65
|
-
{
|
66
|
-
@name => @value,
|
67
|
-
}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
class ParameterMerger
|
72
|
-
def initialize(parameters1, parameters2)
|
73
|
-
@parameters1 = parameters1
|
74
|
-
@parameters2 = parameters2
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
class OverwriteMerger < ParameterMerger
|
79
|
-
def to_parameters
|
80
|
-
@parameters1.to_parameters.merge(@parameters2.to_parameters)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,283 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
require "active_support/core_ext/object/blank"
|
18
|
-
|
19
|
-
require "groonga/client/searcher/raw_request"
|
20
|
-
|
21
|
-
module Groonga
|
22
|
-
class Client
|
23
|
-
class Searcher
|
24
|
-
module Select
|
25
|
-
class Request < RawRequest
|
26
|
-
def initialize(table_or_parameters)
|
27
|
-
if table_or_parameters.respond_to?(:to_parameters)
|
28
|
-
parameters = table_or_parameters
|
29
|
-
else
|
30
|
-
table_name = table_or_parameters
|
31
|
-
parameters = RequestParameter.new(:table, table_name)
|
32
|
-
end
|
33
|
-
super("select", parameters)
|
34
|
-
end
|
35
|
-
|
36
|
-
def result_set
|
37
|
-
@result_set ||= create_result_set
|
38
|
-
end
|
39
|
-
|
40
|
-
def match_columns(value)
|
41
|
-
add_parameter(OverwriteMerger,
|
42
|
-
MatchColumnsParameter.new(value))
|
43
|
-
end
|
44
|
-
|
45
|
-
def query(value)
|
46
|
-
add_parameter(QueryMerger,
|
47
|
-
RequestParameter.new(:query, value))
|
48
|
-
end
|
49
|
-
|
50
|
-
def filter(expression, values=nil)
|
51
|
-
add_parameter(FilterMerger,
|
52
|
-
FilterParameter.new(expression, values))
|
53
|
-
end
|
54
|
-
|
55
|
-
def output_columns(value)
|
56
|
-
add_parameter(OverwriteMerger,
|
57
|
-
OutputColumnsParameter.new(value))
|
58
|
-
end
|
59
|
-
|
60
|
-
def sortby(value)
|
61
|
-
add_parameter(OverwriteMerger,
|
62
|
-
SortbyParameter.new(value))
|
63
|
-
end
|
64
|
-
alias_method :sort, :sortby
|
65
|
-
|
66
|
-
def offset(value)
|
67
|
-
parameter(:offset, value)
|
68
|
-
end
|
69
|
-
|
70
|
-
def limit(value)
|
71
|
-
parameter(:limit, value)
|
72
|
-
end
|
73
|
-
|
74
|
-
def paginate(page, per_page: 10)
|
75
|
-
page ||= 1
|
76
|
-
page = page.to_i
|
77
|
-
if page <= 0
|
78
|
-
offset = 0
|
79
|
-
else
|
80
|
-
offset = per_page * (page - 1)
|
81
|
-
end
|
82
|
-
offset(offset).limit(per_page)
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
86
|
-
def create_request(parameters)
|
87
|
-
self.class.new(parameters)
|
88
|
-
end
|
89
|
-
|
90
|
-
def create_result_set
|
91
|
-
result_set = ResultSet.new(response)
|
92
|
-
if paginated? and defined?(Kaminari)
|
93
|
-
result_set.extend(Kaminari::ConfigurationMethods::ClassMethods)
|
94
|
-
result_set.extend(Kaminari::PageScopeMethods)
|
95
|
-
end
|
96
|
-
result_set
|
97
|
-
end
|
98
|
-
|
99
|
-
def paginated?
|
100
|
-
parameters = to_parameters
|
101
|
-
parameters.key?(:offset) and parameters.key?(:limit)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# @private
|
106
|
-
class QueryMerger < ParameterMerger
|
107
|
-
def to_parameters
|
108
|
-
params1 = @parameters1.to_parameters
|
109
|
-
params2 = @parameters2.to_parameters
|
110
|
-
params = params1.merge(params2)
|
111
|
-
query1 = params1[:query]
|
112
|
-
query2 = params2[:query]
|
113
|
-
if query1.present? and query2.present?
|
114
|
-
params[:query] = "(#{query1}) (#{query2})"
|
115
|
-
else
|
116
|
-
params[:query] = (query1 || query2)
|
117
|
-
end
|
118
|
-
params
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# @private
|
123
|
-
class FilterMerger < ParameterMerger
|
124
|
-
def to_parameters
|
125
|
-
params1 = @parameters1.to_parameters
|
126
|
-
params2 = @parameters2.to_parameters
|
127
|
-
params = params1.merge(params2)
|
128
|
-
filter1 = params1[:filter]
|
129
|
-
filter2 = params2[:filter]
|
130
|
-
if filter1.present? and filter2.present?
|
131
|
-
params[:filter] = "(#{filter1}) && (#{filter2})"
|
132
|
-
else
|
133
|
-
params[:filter] = (filter1 || filter2)
|
134
|
-
end
|
135
|
-
params
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# @private
|
140
|
-
class MatchColumnsParameter
|
141
|
-
def initialize(match_columns)
|
142
|
-
@match_columns = match_columns
|
143
|
-
end
|
144
|
-
|
145
|
-
def to_parameters
|
146
|
-
if @match_columns.blank?
|
147
|
-
{}
|
148
|
-
else
|
149
|
-
case @match_columns
|
150
|
-
when ::Array
|
151
|
-
match_columns = @match_columns.join(", ")
|
152
|
-
when Symbol
|
153
|
-
match_columns = @match_columns.to_s
|
154
|
-
else
|
155
|
-
match_columns = @match_columns
|
156
|
-
end
|
157
|
-
{
|
158
|
-
match_columns: match_columns,
|
159
|
-
}
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
# @private
|
165
|
-
class FilterParameter
|
166
|
-
def initialize(expression, values)
|
167
|
-
@expression = expression
|
168
|
-
@values = values
|
169
|
-
end
|
170
|
-
|
171
|
-
def to_parameters
|
172
|
-
if @expression.blank?
|
173
|
-
{}
|
174
|
-
else
|
175
|
-
if @values.blank?
|
176
|
-
expression = @expression
|
177
|
-
else
|
178
|
-
escaped_values = {}
|
179
|
-
@values.each do |key, value|
|
180
|
-
escaped_values[key] = escape_filter_value(value)
|
181
|
-
end
|
182
|
-
expression = @expression % escaped_values
|
183
|
-
end
|
184
|
-
{
|
185
|
-
filter: expression,
|
186
|
-
}
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
private
|
191
|
-
def escape_filter_value(value)
|
192
|
-
case value
|
193
|
-
when Numeric
|
194
|
-
value
|
195
|
-
when TrueClass, FalseClass
|
196
|
-
value
|
197
|
-
when NilClass
|
198
|
-
"null"
|
199
|
-
when String
|
200
|
-
ScriptSyntax.format_string(value)
|
201
|
-
when Symbol
|
202
|
-
ScriptSyntax.format_string(value.to_s)
|
203
|
-
when ::Array
|
204
|
-
escaped_value = "["
|
205
|
-
value.each_with_index do |element, i|
|
206
|
-
escaped_value << ", " if i > 0
|
207
|
-
escaped_value << escape_filter_value(element)
|
208
|
-
end
|
209
|
-
escaped_value << "]"
|
210
|
-
escaped_value
|
211
|
-
when ::Hash
|
212
|
-
escaped_value = "{"
|
213
|
-
value.each_with_index do |(k, v), i|
|
214
|
-
escaped_value << ", " if i > 0
|
215
|
-
escaped_value << escape_filter_value(k.to_s)
|
216
|
-
escaped_value << ": "
|
217
|
-
escaped_value << escape_filter_value(v)
|
218
|
-
end
|
219
|
-
escaped_value << "}"
|
220
|
-
escaped_value
|
221
|
-
else
|
222
|
-
value
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
# @private
|
228
|
-
class OutputColumnsParameter
|
229
|
-
def initialize(output_columns)
|
230
|
-
@output_columns = output_columns
|
231
|
-
end
|
232
|
-
|
233
|
-
def to_parameters
|
234
|
-
if @output_columns.blank?
|
235
|
-
{}
|
236
|
-
else
|
237
|
-
case @output_columns
|
238
|
-
when ::Array
|
239
|
-
output_columns = @output_columns.join(", ")
|
240
|
-
when Symbol
|
241
|
-
output_columns = @output_columns.to_s
|
242
|
-
else
|
243
|
-
output_columns = @output_columns
|
244
|
-
end
|
245
|
-
parameters = {
|
246
|
-
output_columns: output_columns,
|
247
|
-
}
|
248
|
-
if output_columns.include?("(")
|
249
|
-
parameters[:command_version] = "2"
|
250
|
-
end
|
251
|
-
parameters
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
# @private
|
257
|
-
class SortbyParameter
|
258
|
-
def initialize(sortby)
|
259
|
-
@sortby = sortby
|
260
|
-
end
|
261
|
-
|
262
|
-
def to_parameters
|
263
|
-
if @sortby.blank?
|
264
|
-
{}
|
265
|
-
else
|
266
|
-
case @sortby
|
267
|
-
when ::Array
|
268
|
-
sortby = @sortby.collect(&:to_s).join(", ")
|
269
|
-
when Symbol
|
270
|
-
sortby = @sortby.to_s
|
271
|
-
else
|
272
|
-
sortby = @sortby
|
273
|
-
end
|
274
|
-
{
|
275
|
-
sortby: sortby,
|
276
|
-
}
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
module Groonga
|
18
|
-
class Client
|
19
|
-
class Searcher
|
20
|
-
module Select
|
21
|
-
class ResultSet
|
22
|
-
def initialize(response)
|
23
|
-
@response = response
|
24
|
-
end
|
25
|
-
|
26
|
-
def n_hits
|
27
|
-
@response.n_hits
|
28
|
-
end
|
29
|
-
# For Kaminari
|
30
|
-
alias_method :total_count, :n_hits
|
31
|
-
|
32
|
-
# For Kaminari
|
33
|
-
def limit_value
|
34
|
-
(@response.command[:limit] || 10).to_i
|
35
|
-
end
|
36
|
-
|
37
|
-
# For Kaminari
|
38
|
-
def offset_value
|
39
|
-
(@response.command[:offset] || 0).to_i
|
40
|
-
end
|
41
|
-
|
42
|
-
def records
|
43
|
-
@records ||= build_records
|
44
|
-
end
|
45
|
-
|
46
|
-
def sources
|
47
|
-
@sources ||= fetch_sources
|
48
|
-
end
|
49
|
-
|
50
|
-
def drilldowns
|
51
|
-
@response.drilldowns
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
def build_records
|
56
|
-
@response.records.collect.with_index do |record, i|
|
57
|
-
Record.new(self, i, record)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def fetch_sources
|
62
|
-
source_ids = {}
|
63
|
-
records.collect do |record|
|
64
|
-
model_name, id = record["_key"].split(/-/, 2)
|
65
|
-
source_ids[model_name] ||= []
|
66
|
-
source_ids[model_name] << id
|
67
|
-
end
|
68
|
-
sources = {}
|
69
|
-
source_ids.each do |model_name, ids|
|
70
|
-
model_name.constantize.find(ids).each_with_index do |model, i|
|
71
|
-
sources["#{model_name}-#{ids[i]}"] = model
|
72
|
-
end
|
73
|
-
end
|
74
|
-
records.collect do |record|
|
75
|
-
sources[record["_key"]]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
class Record
|
80
|
-
def initialize(result_set, nth, raw_record)
|
81
|
-
@result_set = result_set
|
82
|
-
@nth = nth
|
83
|
-
@raw_record = raw_record
|
84
|
-
end
|
85
|
-
|
86
|
-
def source
|
87
|
-
@result_set.sources[@nth]
|
88
|
-
end
|
89
|
-
|
90
|
-
def [](name)
|
91
|
-
@raw_record[normalize_name(name)]
|
92
|
-
end
|
93
|
-
|
94
|
-
def method_missing(name, *args, &block)
|
95
|
-
return super unless args.empty?
|
96
|
-
return super unless @raw_record.key?(name.to_s)
|
97
|
-
|
98
|
-
self[name]
|
99
|
-
end
|
100
|
-
|
101
|
-
def respond_to_missing?(name, *args, &block)
|
102
|
-
return super unless args.empty?
|
103
|
-
return super unless @raw_record.key?(name.to_s)
|
104
|
-
|
105
|
-
@raw_record.key?(normalize_name(name))
|
106
|
-
end
|
107
|
-
|
108
|
-
private
|
109
|
-
def normalize_name(name)
|
110
|
-
name.to_s
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
2
|
-
#
|
3
|
-
# This library is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU Lesser General Public
|
5
|
-
# License as published by the Free Software Foundation; either
|
6
|
-
# version 2.1 of the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This library is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this library; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
-
|
17
|
-
require "groonga/client/searcher/select/request"
|
18
|
-
require "groonga/client/searcher/select/result_set"
|