Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/can-sahin/stackexchange.redis.wordsearch
AutoCompletion/WordSearch extension for StackExchange.Redis
https://github.com/can-sahin/stackexchange.redis.wordsearch
autocompletion redis stackexchange-redis
Last synced: 25 days ago
JSON representation
AutoCompletion/WordSearch extension for StackExchange.Redis
- Host: GitHub
- URL: https://github.com/can-sahin/stackexchange.redis.wordsearch
- Owner: Can-Sahin
- License: mit
- Created: 2017-11-10T10:42:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-08T18:38:32.000Z (about 7 years ago)
- Last Synced: 2024-12-06T12:08:27.663Z (about 1 month ago)
- Topics: autocompletion, redis, stackexchange-redis
- Language: C#
- Homepage:
- Size: 191 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StackExchange.Redis.WordSearch
AutoComplete, Word Search extension for [StackExchange.Redis] implemented with internal Redis Data Structures.
Extra features:
1. Raw/serialized data attachment to a searchable word.
2. Popularity Ranking# Requirements
1. `.NET Standards 1.6`
2. `StackExchange.Redis 1.2.6`# Installation
`PM> Install-Package StackExchange.Redis.WordSearch`or
`$ dotnet add package StackExchange.Redis.WordSearch`
**See the [docs] for usage and examples**
# Basic Usage
For basic AutoCompletion:
```csharp
// IDatabase database = ConnectionMultiplexer.GetDatabase();
IRedisWordSearch redisSearch = new RedisWordSearch(database); //Use IRedisWordSearch to see the xml documentation
redisSearch.Add("IdOfWatson", "EmmaWatson");
redisSearch.Add("IdOfStone", "EmmaStone");List results = redisSearch.Search("Emm").AsStringList();
// ["EmmaWatson", "EmmaStone"]
// Also supports "mma" style searches
```
Ranking Popular Searches:
```csharp
// IDatabase database = ConnectionMultiplexer.GetDatabase();
RedisWordSearchConfiguration config = RedisWordSearchConfiguration.defaultConfig;
config.RankingProvider = new CurrentlyPopularRanking(ANCHOR_EPOCH, 24); //24 hours half lifeIRedisWordSearch redisSearch = new RedisWordSearch(database, config);
redisSearch.Add("IdOfWatson", "EmmaWatson");
redisSearch.Add("IdOfStone", "EmmaStone");// Typically when application-side clicks/votes/interacts to a search result
redisSearch.BoostInRanking("IdOfStone");
redisSearch.BoostInRanking("IdOfWatson");
redisSearch.BoostInRanking("IdOfWatson");
List results = redisSearch.Search("Emma").AsStringList();
// ["EmmaWatson", "EmmaStone"] EmmaWatson is ordered first because she is twice as popularvar words = redisSearch.TopRankedSearches().AsStringList();
// ["EmmaWatson", "EmmaStone"] EmmaWatson is ordered first because she is twice as popular
```
See the [docs] for detailed `Ranking` explanationSerialized Data:
```csharp
// IDatabase database = ConnectionMultiplexer.GetDatabase();
RedisWordSearchConfiguration config = RedisWordSearchConfiguration.defaultConfig;
config.Serializer = new MyJsonSerializer();IRedisWordSearch wordSearch = new RedisWordSearch(database,config);
wordSearch.Add("IdOfWatson", "EmmaWatson", new PartnerForEmma("HarryPotter"));
wordSearch.Add("IdOfStone", "EmmaStone", new PartnerForEmma("PeterParker"));List results = wordSearch.Search("Emma");
```Use `RedisWordSearchConfiguration` to:
- Enable Popularity Ranking (default half life decay rate algorithm is implemented)
- Limit min/max search length
- Put Redis Key Prefix
- Enable Case Insensivity
- Specify searching method (autocomplete sequentially or autocomplete fuzzy search("mma" for searching "EmmaWatson")**For details: [docs]**
# License
MIT[StackExchange.Redis]:
[docs]: