TGStat
TGStat
Введите текст для поиска
Расширенный поиск каналов
  • flag Russian
    Язык сайта
    flag Russian flag English flag Uzbek
  • Вход на сайт
  • Каталог
    Каталог каналов и чатов Региональные подборки Тематические подборки Платные каналы Поиск каналов
    Добавить канал/чат
  • Рейтинги
    Рейтинг каналов Рейтинг чатов Рейтинг публикаций
    Рейтинги брендов и персон
  • Аналитика
  • Поиск по публикациям
  • Мониторинг Telegram
  • Продвижение
    Реклама через Яндекс Бизнес Реклама в каналах через TGStat Agency Реклама на сайте TGStat.ru
не лёха

29 Jul 2024, 20:55

Открыть в Telegram Поделиться Пожаловаться

recently got to use meilisearch — a search system that is just like elasticsearch, but for smaller data amounts and easier to get to and start using. used it in an environment of typescript (node.js) and a self-hosted instance of meilisearch

first of all, it's so much easier to set this whole thing up than i thought it would be. although, i need to say that the whole "second-ish database that is constantly indexed" thing is new to me, so i had to understand that. basically, all you have to do is to addDocuments into your index instance of the meilisearch (and update it every time any document is created/edited/deleted on the main database so both dbs are in sync), probably updateTypoTolerance so you can search and accept a few typos and then simply index.search('hello')!

const index = meilisearch.index('messages')

const messages = [
{ global_id: 1, chat_id: 10, message_id: 1, from: { user_id: 1, first_name: 'John', last_name: 'Doe' }, text: 'Hello world!' },
{ global_id: 2, chat_id: 10, message_id: 2, from: { user_id: 2, first_name: 'Jane', last_name: 'Doe' }, text: 'Hi!' },
{ global_id: 3, chat_id: 10, message_id: 3, from: { user_id: 1, first_name: 'John', last_name: 'Doe' }, text: 'How are you?' },
...
]

const response = await index.addDocuments(messages, {
primaryKey: 'global_id'
})

const response = await index.search('hello', {
attributesToSearchOn: ['text'],
filter: 'from.user_id = 1 AND chat_id = 10'
})

i've been thinking about creating at least my own API for my own messenger (tm), but i've never thought about the search system. like, how the search bar in the telegram even work? i could not understand it until i tried out meilisearch. it's definitely a good experience overall, would recommend, ign, blah-blah-blah. wanna experiment with some other stuff more, probably will and probably will post it on here. stay tuned!

787 0 3 4
Каталог
Каталог каналов и чатов Подборки каналов Поиск каналов Добавить канал/чат
Рейтинги
Рейтинг каналов Telegram Рейтинг чатов Telegram Рейтинг публикаций Рейтинги брендов и персон
API
API статистики API поиска публикаций API Callback
Наши каналы
@TGStat @TGStat_Chat @telepulse @TGStatAPI
Почитать
Академия TGStat Исследование Telegram 2019 Исследование Telegram 2021 Исследование Telegram 2023
Контакты
Справочный центр Поддержка Почта Вакансии
Всякая всячина
Пользовательское соглашение Политика конфиденциальности Публичная оферта
Наши боты
@TGStat_Bot @SearcheeBot @TGAlertsBot @tg_analytics_bot @TGStatChatBot