Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
meilisearch
Advanced tools
The Javascript client for MeiliSearch API.
MeiliSearch provides an ultra relevant and instant full-text search. Our solution is open-source and you can check out our repository here.
Here is the MeiliSearch documentation 📖
npm install meilisearch
yarn add meilisearch
There are many easy ways to download and run a MeiliSearch instance.
For example, if you use Docker:
$ docker run -it --rm -p 7700:7700 getmeili/meilisearch:latest --api-key=apiKey
NB: you can also download MeiliSearch from Homebrew or APT.
Here is a quickstart for a search request
const Meili = require('meilisearch')
// Credentials of your MeiliSearch Instance
const config = {
host: 'http://127.0.0.1:7700',
apiKey: 'masterKey',
}
const meili = new Meili(config)
meili
.Index('movies')
.search('batman')
.then((response) => {
console.log(response.hits)
})
Go checkout examples!
Example:
meili
.Index('movies')
.search('batman')
.then((response) => {
console.log(response.hits)
})
Response:
{
"hits": [
{
"id": "2661",
"title": "Batman",
"poster": "https://image.tmdb.org/t/p/w1280/udDVJXtAFsQ8DimrXkVFqy4DGEQ.jpg",
"overview": "The Dynamic Duo faces four super-villains who plan to hold the world for ransom with the help of a secret invention that instantly dehydrates people.",
"release_date": -108086400
},
{
"id": "268",
"title": "Batman",
"poster": "https://image.tmdb.org/t/p/w1280/kBf3g9crrADGMc2AMAMlLBgSm2h.jpg",
"overview": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker, who has seized control of Gotham's underworld.",
"release_date": 614566800
},
{
"id": "29751",
"title": "Batman Unmasked: The Psychology of the Dark Knight",
"poster": "https:/0/image.tmdb.org/t/p/w1280/jjHu128XLARc2k4cJrblAvZe0HE.jpg",
"overview": "Delve into the world of Batman and the vigilante justice that he brought to the city of Gotham. Batman is a man who, after experiencing great tragedy, devotes his life to an ideal--but what happens when one man takes on the evil underworld alone? Examine why Batman is who he is--and explore how a boy scarred by tragedy becomes a symbol of hope to everyone else.",
"release_date": 1216083600
}
],
"offset": 0,
"limit": 3,
"processingTimeMs": 4,
"query": "batman"
}
This methods list all indexes of a database
Example:
meili.listIndexes().then((indexes) => {
console.log(indexes)
})
Response:
[
{
"name": "Movies",
"uid": "movies",
"createdAt": "2019-11-25T14:06:54.340482Z",
"updatedAt": "2019-11-25T14:07:00.736937Z"
}
]
This methods create a new index
Example:
meili
.createIndex({
name: 'Movie',
uid: 'movies',
})
.then((indexes) => {
console.log(indexes)
})
Response:
{
"name": "Movies",
"uid": "movies",
"createdAt": "2019-11-25T14:38:49.846352Z",
"updatedAt": "2019-11-25T14:38:49.846353Z"
}
Will push to the indexing queue documents on body
Example:
meili
.Index('movies')
.addDocuments([
{
id: 1,
title: 'My awesome movie',
},
])
.then((indexes) => {
console.log(indexes)
})
Response:
{
"updateId": 1
}
The method add_documents
is asynchronous.
getDocuments is a method to get defaults documents without search. This method is usually used to display results when you have no input in the search bar.
Example:
meili
.Index('movies')
.getDocuments({
limit: 3,
})
.then((response) => {
console.log(response)
})
Reponse:
[
{
"id": "279664",
"title": "Green Chair 2013 - Love Conceptually",
"poster": "https://image.tmdb.org/t/p/w1280/9H8vACDBSBs8NXO6NfLH3i9ZsYq.jpg",
"overview": "Moon-hee is an attractive woman who runs an art academy after returning from the States. She lives apart from her husband who won't divorce her and enjoys a free relationship with In-gyu, her lover of long time and Professor Yoon whom she's been privately involved with for a long time. On the other hand, her young student Joo Won only draws her face during class. He fell in love with her when he saw Moon-hee as a bride at the wedding his grandma took him too. He started art because of her and started attending the academy. He thinks it's destiny. Moon-hee is attracted to Joo Won's pure heart until they share love in in a studio where it's just them....",
"release_date": 1383177600
},
{
"id": "13342",
"title": "Fast Times at Ridgemont High",
"poster": "https://image.tmdb.org/t/p/w1280/9y5rSeO0xH3m5oRJmhBusDkiS0j.jpg",
"overview": "Follows a group of high school students growing up in southern California, based on the real-life adventures chronicled by Cameron Crowe. Stacy Hamilton and Mark Ratner are looking for a love interest, and are helped along by their older classmates, Linda Barrett and Mike Damone, respectively. The center of the film is held by Jeff Spicoli, a perpetually stoned surfer dude who faces off with the resolute Mr. Hand, who is convinced that everyone is on dope.",
"release_date": 398048400
},
{
"id": "25087",
"title": "Bloodsport II",
"poster": "https://image.tmdb.org/t/p/w1280/xVfSGAbOK4FucTwkYrXJjeBFqv4.jpg",
"overview": "After thief Alex Cardo gets caught while stealing an ancient katana in East Asia, he soon finds himself imprisoned and beaten up by the crowd there. One of the guards, Demon, feels upset by Alex appearance and tortures him as often as he gets the opportunity. Alex finds a friend and mentor in the jailhouse, Master Sun, who teaches him a superior fighting style called Iron Hand. When a 'best of the best kumite' is to take place, Demon gets an invitation. Now Master Sun and Alex need to find a way to let Alex take part in the kumite too.",
"release_date": 825638400
}
]
meili.Index('xxx').search(query: string, options?: Types.SearchParams): Promise<Types.SearchResponse>
meili.listIndexes(): Promise<object[]>
meili.createIndex(data: Types.CreateIndexRequest): Promise<Types.CreateIndexResponse>
meili.Index('xxx').getIndex(): Promise<Types.index>
meili.Index('xxx').updateIndex(data: Types.UpdateIndexRequest): Promise<Types.index>
meili.Index('xxx').deleteIndex(): Promise<void>
meili.Index('xxx').getStats(): Promise<object>
meili.Index('xxx').getUpdate(updateId: number): Promise<object>
meili.Index('xxx').getAllUpdates(): Promise<object[]>
meili.Index('xxx').addDocuments(documents: object[]): Promise<Types.AsyncUpdateId>
meili.Index('xxx').getDocuments(params: Types.getDocumentsParams): Promise<object[]>
meili.Index('xxx').getDocument(documentId: string): Promise<object>
meili.Index('xxx').deleteDocument(documentId: string): Promise<Types.AsyncUpdateId>
meili.Index('xxx').deleteDocuments(documentsIds: string[]): Promise<Types.AsyncUpdateId>
meili.Index('xxx').getSettings(): Promise<object>
meili.Index('xxx').updateSettings(settings: object): Promise<void>
meili.Index('xxx').listSynonyms(): Promise<object[]>
meili.Index('xxx').createSynonym(input: string, synonyms: string[]): Promise<object>
Waiting on MeiliSearch v0.9.0
meili.isHealthy(): Promise<void>
meili.setHealthy(): Promise<void>
meili.setUnhealthy(): Promise<void>
meili.changeHealthTo(health: boolean): Promise<void>
meili.databaseStats(): Promise<object>
meili.version(): Promise<object>
meili.systemInformation(): Promise<object>
meili.systemInformationPretty(): Promise<object>
FAQs
The Meilisearch JS client for Node.js and the browser.
The npm package meilisearch receives a total of 81,781 weekly downloads. As such, meilisearch popularity was classified as popular.
We found that meilisearch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.