All Projects → huacnlee → Redis Search

huacnlee / Redis Search

Licence: mit
Deprecated! High performance real-time prefix search, indexes store in Redis for Rails application

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Redis Search

Datoji
A tiny JSON storage service. Create, Read, Update, Delete and Search JSON data.
Stars: ✭ 222 (-68.86%)
Mutual labels:  redis, rails
Recommendable
👍👎 A recommendation engine using Likes and Dislikes for your Ruby app
Stars: ✭ 1,340 (+87.94%)
Mutual labels:  redis, rails
Redis Rails
Redis stores for Ruby on Rails
Stars: ✭ 904 (+26.79%)
Mutual labels:  redis, rails
Gdpr Rails
An example project on building a GDPR compliant application
Stars: ✭ 109 (-84.71%)
Mutual labels:  redis, rails
Redis dashboard
Sinatra app to monitor Redis servers.
Stars: ✭ 141 (-80.22%)
Mutual labels:  redis, rails
Redis web manager
Manage your Redis instance (see keys, memory used, connected client, etc...)
Stars: ✭ 139 (-80.5%)
Mutual labels:  redis, rails
Entangled
Rails in real time
Stars: ✭ 108 (-84.85%)
Mutual labels:  redis, rails
Flipper
🐬 Beautiful, performant feature flags for Ruby.
Stars: ✭ 2,732 (+283.17%)
Mutual labels:  redis, rails
Split
📈 The Rack Based A/B testing framework
Stars: ✭ 2,539 (+256.1%)
Mutual labels:  redis, rails
Good job
Multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
Stars: ✭ 676 (-5.19%)
Mutual labels:  rails
Stories
Medium clone built with Ruby on Rails
Stars: ✭ 688 (-3.51%)
Mutual labels:  rails
Pinyin
🇨🇳 汉字拼音 ➜ hàn zì pīn yīn
Stars: ✭ 6,047 (+748.11%)
Mutual labels:  pinyin
Oneblog
👽 OneBlog,一个简洁美观、功能强大并且自适应的Java博客
Stars: ✭ 678 (-4.91%)
Mutual labels:  redis
Zxw.framework.netcore
基于EF Core的Code First模式的DotNetCore快速开发框架,其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器(也支持DB First)、基于AspectCore的memcache和Redis缓存组件,以及基于ICanPay的支付库和一些日常用的方法和扩展,比如批量插入、更新、删除以及触发器支持,当然还有demo。欢迎提交各种建议、意见和pr~
Stars: ✭ 691 (-3.09%)
Mutual labels:  redis
Newsblur
NewsBlur is a personal news reader that brings people together to talk about the world. A new sound of an old instrument.
Stars: ✭ 5,862 (+722.16%)
Mutual labels:  redis
Browserify Rails
Browserify + Rails = a great way to modularize your legacy JavaScript
Stars: ✭ 701 (-1.68%)
Mutual labels:  rails
Abp Asp.net Boilerplate Project Cms
ABP module-zero +AdminLTE+Bootstrap Table+jQuery+Redis + sql server+quartz+hangfire权限管理系统
Stars: ✭ 677 (-5.05%)
Mutual labels:  redis
Yt
The reliable YouTube API Ruby client
Stars: ✭ 674 (-5.47%)
Mutual labels:  rails
Bifrost
Bifrost ---- 面向生产环境的 MySQL 同步到Redis,MongoDB,ClickHouse,MySQL等服务的异构中间件
Stars: ✭ 701 (-1.68%)
Mutual labels:  redis
Fae
CMS for Rails. For Reals.
Stars: ✭ 701 (-1.68%)
Mutual labels:  rails

Redis-Search (Deprecated! 不在维护!)

High performance real-time prefix search, indexes store in Redis for Rails application. 中文介绍和使用说明

NOTE!

There have more better ways you can choice!

下面的两种方式将是更好的选择:

Master Status

Gem Version CI Status CodeCov

Features

  • Real-time search
  • High performance
  • Prefix match search
  • Support match with alias
  • Support ActiveRecord and Mongoid
  • Sort results by one field
  • Homophone search, pinyin search
  • Search as pinyin first chars
  • Conditions support

Requirements

  • Redis 2.2+

Install

gem 'redis-search'
$ bundle install

Configure

  • Create file in: config/initializers/redis-search.rb
require "redis"
require "redis-namespace"
require "redis-search"

# don't forget change namespace
redis = Redis.new(host: '127.0.0.1', port: '6379')
# We suggest you use a special db in Redis, when you need to clear all data, you can use `flushdb` command to cleanup.
redis.select(3)
# Give a special namespace as prefix for Redis key, when your have more than one project used redis-search, this config will make them work fine.
redis = Redis::Namespace.new("your_app_name:redis_search", redis: redis)
Redis::Search.configure do |config|
  config.redis = redis
  config.complete_max_length = 100
  config.pinyin_match = true
end

Usage

  • Bind Redis::Search callback event, it will to rebuild search indices when data create or update.
class Post < ActiveRecord::Base
  include Redis::Search

  belongs_to :user
  belongs_to :category

  redis_search title_field: :title,
               score_field: :hits,
               condition_fields: [:user_id, :category_id],
               ext_fields: [:category_name]

  def category_name
    self.category.name
  end
end
class User < ActiveRecord::Base
  include Redis::Search

  serialize :alias_names, Array

  redis_search title_field: :name,
               alias_field: :alias_names,
               score_field: :followers_count,
               ext_fields: [:email, :tagline]
end
class SearchController < ApplicationController
  # GET /search_users?q=j
  def search_users
    Post.prefix_match(params[:q], conditions: { user_id: 12, category_id: 4 })
  end
end

Index data to Redis

Specify Model

Redis-Search index data to Redis from your model (pass name as CLASS environment variable).

$ rake redis_search:index:model CLASS='User'

Customize the batch size:

$ rake redis_search:index:model CLASS='User' BATCH=100

All Models

Redis-Search all index data to Redis from app/models (or use DIR environment variabl).

$ rake redis_search:index DIR=app/models

Customize the batch size:

$ rake redis_search:index DIR=app/models BATCH=100

Documentation

Benchmark test

You can run the rake command (see Rakefile) to make test. There is my performance test result.

Demo

Projects used redis-search:

License

  • MIT
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].