Skip to content

nodef/extra-text-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package provides simplified searching through text content of documents.

▌ 📦 JSR, 📰 Docs.



import {ReferenceIndex} from "jsr:@nodef/extra-text-search";


const index = new ReferenceIndex();

// Add some text to the index
index.add("doc1", "Humpty Dumpty sat on a wall.");
index.add("doc2", "Humpty Dumpty had a great fall!");
index.add("doc3", "Like a sunflower that follows every movement of the sun.");
index.add("doc4", "The sun is a mass of incandescent gas, a gigantic nuclear furnace.");

// Search for flowers
index.search("flowers");
// → Map(2) { "doc3" => 0.08733909728084097 }

// Search for umpty fall great
index.search("umpty fall great");
// → Map(2) { "doc2" => 0.45927932677184585, "doc3" => 1.6738179909018382 }


License

This project is licensed under AGPL-3.0.




ORG

About

Simplified searching through text content of documents.

Resources

License

Stars

Watchers

Forks