Socket
Book a DemoInstallSign in
Socket

solr_collection

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solr_collection

0.1.5
bundlerRubygems
Version published
Maintainers
1
Created
Source
  • Wrap acts_as_solr results to behave like WillPaginate (use same helpers!)
  • Make arrays behave like solr results (e.g. mock an empty result when solr is down or throws errors)

Usage

  • As Rails plugin rails plugin install git://github.com/grosser/solr_collection.git
  • As gem sudo gem install solr_collection

Example: options = {:limit=>10, :offset=>100, :facets=>{....}, .... } results = MyModel.find_by_solr("abc", options) rescue [] results = SolrCollection.new(results, options.slice(:limit, :offset))

do_something if results.facets
do_something if results.total_entries > results.size # more pages ?
will_paginate(results)

Other features: #facet fields can be nil or [] or {} -> use has_facet_fields? to check puts results.facets['facet_fields']['category_id_facet'] if results.has_facet_fields? puts results.facet_field('category_id_facet')

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

FAQs

Package last updated on 04 Feb 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.