
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
mwmitchell-rsolr-ext
Advanced tools
=RSolr::Ext A set of helper methods/modules to assist in building Solr queries and handling responses when using the RSolr library.
==Related Resources & Projects
==Requests To use the RSolr::Ext connection instead of the normal RSolr connection: solr = RSolr::Ext.connect
RSolr::Ext adds a #find and a #luke_admin method to the connection object.
===#luke The #luke method returns a Hash/Mash result of a /admin/luke?numTerms=0 request: luke_response = solr.luke luke_response['index'] luke_response['fields'] luke_response['info']
===#find The #find method listens for certain keys. All other keys are ignored, allowing the ability to mix-and-match special keys with normal Solr param keys. The recognized keys are describe below.
:page - This maps to the Solr "start" param. The current "page" in the results set. RSolr::Ext handles the page-to-rows math for you.
:per_page - This maps to the Solr "rows" param. How many "pages" in the result.
:queries - This key maps to the Solr "q" param. Accepts a string, array or hash. When an array is used, each value is joined by a space. When a hash is used, the keys are used as Solr fields.
:phrases - This value is mapped to the Solr "q" param. When this key is used, the value will become double-quoted, creating a Solr "phrase" based query.
:filters - The :filters key maps to the Solr :fq param. This has the same behavior as the :queries key, except it's for the :fq param.
:phrase_filters - The :phrase_filters key maps to the Solr :fq param. This has the same behavior as the :phrases key, except it's for the :fq param.
:facets - The :facets does a few different things. First, it sets the Solr param facet=true. It accepts a hash with a single key called :fields. This should be an array of field names to facet on.
==Request Example solr = RSolr::Ext.connect solr_params = { :page=>2, :per_page=>10, :phrases=>{:name=>'This is a phrase'}, :filters=>['test', {:price=>(1..10)}], :phrase_filters=>{:manu=>['Apple']}, :queries=>'ipod', :facets=>{:fields=>['cat', 'blah']}, :echoParams => 'EXPLICIT' } response = rsolr.find solr_params
==Responses RSolr::Ext decorates the normal output hash from RSolr and adds some helpful methods.
solr = RSolr::Ext.connect
response = solr.find :q=>':'
response.ok? response.params response.docs response.docs.previous_page response.docs.next_page response.facets.each do |facet| puts facet.name facet.items.each do |item| puts "#{facet.name}::#{item.value} (#{item.hits})" end end
You can access values in the response hash using symbols or strings.
===Documents/Pagination If you wanna paginate, just throw the collection into the WillPaginate view helper. <%= will_paginate response.docs %>
==The "Model" Module You can create your own "models" using RSolr::Ext::Model
class Book include RSolr::Ext::Model def self.find_by_author(author) find(:fq=>'object_type:"book"', :rows=>10, :phrase_filters=>{:author=>author}) end end
all_books = Book.find(':') hawk_books = Book.find_by_author('hawk')
FAQs
Unknown package
We found that mwmitchell-rsolr-ext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.