
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.
customized-mongomapper-search
Advanced tools
= tsxn-mongomapper-search
Easily integrate Mongo Mapper with with Solr search. Please view the CHANGELOG before updating the gem.
== Credits
Earlier versions < 1.0.0 were based off the mongomapper-search gem written by Fernando Meyer that can be found at http://github.com/fmeyer/mongomapper-search.
== Usage == Version 1.0.2
To make a MongoMapper::Document indexable add the following line to include the functionality:
include Search::Indexable
The Solr URL must be specified using the :solr_url method. e.g.
solr_url "http://localhost/solr/some.core"
To specify that the index and delete operations into Solr should be force committed the :idx_force_commit method must be passed a value of true. It currently defaults to a value of false. e.g.
idx_force_commit true
To specify which attributes that need to be indexable pass hashes with the attributes and the corresponding indexed names to the :idx_attr method. e.g.
idx_attr :_id => "object_id", :name => "title", :foo => "bar"
To specify which :many associations that need to be indexable pass hashes with the name of the associations and the namespace the attributes of the association should be indexed under to the :idx_assoc method. A blank namespace will result in no namespace to be pre-appended to the association attribute names. e.g.
idx_assoc :object_relations => "foo"
To add search functionality add the following line to include:
include Search::Searchable
== An indexing example
Define a EmbeddedDocument model and specify the indexable fields. The following model does not specify the Solr URL because it is a not a first class document.
class Project
include MongoMapper::EmbeddedDocument
include Search::Indexable
idx_attr :name => "proj_name"
key :name
end
Define a Document model and specify the indexable fields and associations.
class Employee
include MongoMapper::Document
include Search::Indexable
include Search::Searchable
solr_url "http://search-api.search.com/solr/employee.core"
idx_attr :_id => "emp_id", :name => "emp_name"
idx_assoc :projects => "emp_project"
idx_force_commit true
key :name
many :projects
end
Saving an instance of Employee causes that employee to be indexed in Solr. The Lucene document that's indexed would appear something like:
employee doc
emp_id = val
emp_name = val
emp_project.proj_name = val1
emp_project.proj_name = val2
emp_project.proj_name = ....
emp_project.proj_name = valN
== A searching example
Employee.search('emp_name:"John Doe" emp_project.proj_name:"search"', :qt => 'dismax')
== Feedback & Contributions
If the documentation here is not very clear please email me any suggested improvements. Also if you would like me to pull changes from a fork to the master let me know.
FAQs
Unknown package
We found that customized-mongomapper-search 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.