npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

solr2solr

v1.0.0

Published

Migrate one Solr index to another, and multiply/manipulate the data on the way

Readme

solr2solr - a simple Solr migration and test data frabrication tool

This tool will query a given Solr index and copy it to another. Along the way it will give you the opportunity to change field names, drop fields altogether, and fabricate new fields.

The goal of this tool isn't to be a suitable means to move large production indices around, though if your index is smallish, it will serve that purpose. It is instead meant to facilitate the development lifecycle during which schemas are constantly changing and real data isn't yet available, or isn't available in a quantity to stress Solr.

Install

solr2solr is a command line tool and should ideally be installed with -g

$ npm install -g solr2solr

Configuration

Copy the example config file from the root of the github repo into a directory on your machine.

from and to are pass through configurations to the node-solr library. These are the defaults:

var DEFAULTS = {
  host: '127.0.0.1',
  port: '8983',
  core: '', // if defined, should begin with a slash
  path: '/solr' // should also begin with a slash
}

query is used to hit the from Solr for documents. Leave this at *:* if you want to copy everything, or change it to something else if you want to copy a smaller set of documents.

rows indicates how many rows to copy at a time. solr2solr will go through your index from start to finish by this increment. This increment is important because based on the size of a document in your index, and how many times you might want that document duplicated (see duplicate below), you'll want to play with this number to keep your node process from running out of memory.

duplicate is a configuration will allow you to multiply your index during the copy. When duplicate has enabled set to true, solr2solr will manipulate the idField of your document to make it unique and it will create an extra document per numberOfTimes. So, if numberOfTimes is set to 2, you'll get 2 copies of every document. The original, and 2 dupes.

copy is a list of fields to copy from index to index verbatim.

transform is a list of fields to copy from index to index while changing the field name from source to destination.

fabricate is a list of new fields to create per document in the new index. The name of the new field is given in the field name, and the data for that field is created by the fabricate function, which is passed the document and the row number being processed.

fabricate:(fields, index) ->
  switch index % 5
    when 0 then 'Swahili'
    when 1 then 'Klingon'
    when 2 then 'Skrull'
    when 3 then 'Pig Latin'
    when 4 then 'English'
}

Execution

From the same directory you placed the config file, simply execute

$ solr2solr

and the tool will begin copying data. It will write to the console each time it goes to fetch another batch of data from Solr.