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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sephir/easy-search

v0.9.6

Published

easy search system

Downloads

4

Readme

A Painfully Simple Search System.

Make files in folder/s searchable. (NODE JS)

Install

npm i @sephir/easy-search

Usage

var easysearch = require('@sephir/easy-search')

// feed an array of folders containing the documents. It doesn't do subfolders.
var searchIndex = await easysearch.indexFolder( ["some/folder/here", "another/folder/here"], html=false, contextWindowSize=10 )
//If your documents are html, then flip the html parameter to true, so that tags can be ignored.

// To search feed the index object and the query
var results = easysearch.search( searchIndex, "your query here")

// results contains an array of objects, each object contains a document number and a tf-idf score assigned to it , given your query.

Example

For a working example check out test.js. It's a simple file showing how to index a folder, store the created index and how to retrieve results.

Serialise/Deserialise the Index

// Store your index in a folder
await easysearch.storeIndex( searchIndex, "/some/folder/name" ) // path is a folder 

// Reload your index from a file
var searchIndex = await easysearch.reloadIndex("/some/folder/name") // path is a folder

// If you want to create a single file with the index
await easysearch.storeIndexAsJSONFile(searchIndex, "some/folder/theindex.json") // path is a file
  

UPDATES! v0.9.6

  • Saving index to a single JSON file. This facilitates for a search index to be used statically on a UI interface.

UPDATES! v0.9

  • Improved storage which allows now a LOT more documents to be indexed. Limit being what you can load into RAM.
    • Performance note: Indexing 128k html documents takes ~300 seconds on my hardware.
  • Added context of query words. In search results you can find chunks of text where the query terms have been found.
    • Size of chunks can be configured within the indexFolder parameter ``contextWindowSize''

Get in touch!

If you like the project and want to tell me or propose features let me know!: mailto

Disclaimer

There are many search solutions much more powerful than this one, however they all require substantial learning before using them. Easy-search has been built to provide a very simple search functionality that should be more than enough for most cases, when your dataset consists of a few thousand documents.