mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 14:18:51 +01:00
testing: mongo meilisearch
This commit is contained in:
parent
c27554ed2e
commit
dcc13daf67
9 changed files with 654 additions and 3 deletions
24
api/app/search.js
Normal file
24
api/app/search.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
const mongoose = require('mongoose');
|
||||
const mongomeili = require('mongomeili');
|
||||
const { messageSchema, Message } = require('../models/Message');
|
||||
|
||||
// Add the '{ meiliIndex: true }' property to index these attributes with MeiliSearch
|
||||
// const MovieSchema = new mongoose.Schema({
|
||||
// title: { type: String, required: true, meiliIndex: true },
|
||||
// director: { type: String, required: true, meiliIndex: true },
|
||||
// year: { type: String, required: true, meiliIndex: true }
|
||||
// });
|
||||
|
||||
// Specify your MeiliSearch credentials
|
||||
// messageSchema.plugin(mongomeili, {
|
||||
// host: 'http://localhost:7700',
|
||||
// apiKey: 'MASTER_KEY',
|
||||
// indexName: 'messages' // Will get created automatically if it doesn't exist already
|
||||
// });
|
||||
|
||||
(async () => {
|
||||
await Message.syncWithMeili();
|
||||
const result = await Message.meiliSearch({ query: 'quantum' });
|
||||
|
||||
console.log(result);
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue