-
Notifications
You must be signed in to change notification settings - Fork 46
Add support for extended search commands #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
510c931
start working on Adding Support for FT.SPELLCHECK
shacharPash b630973
tests
shacharPash f4966c8
Add tests
shacharPash c6415a9
Add Bounds tests
shacharPash 43ae14d
Chagne to RedisServerException
shacharPash d4d87b9
fixes
shacharPash 561cf35
add comands to interface
shacharPash f5df688
using SearchArgs
shacharPash af6f1de
Commands implement
shacharPash 059e1fa
delete unused literals
shacharPash c178b60
TestAddAndGetSuggestion
shacharPash ee6ec25
Add SugGetWithScoresAsync
shacharPash fbcf756
assync tests
shacharPash 34ddd77
Support FT.PROFILE
shacharPash e2d8c50
fix parser
shacharPash 64ee31f
fix command builder
shacharPash 258a618
test + fixes
shacharPash 8c43229
add tests
shacharPash 4f27a11
add TestProfileCommandBuilder
shacharPash 36644ef
Merge branch 'master' into ftSearchCommands
shacharPash 3fe326d
space
shacharPash 498560e
Try make Tran&pipe instances not interface type
shacharPash fbe99bf
Add ft.create without FTCreateParams
shacharPash e38814b
tests
shacharPash 2031536
Merge branch 'master' into ftSearchCommands
shacharPash ea22d3c
fix } missing
shacharPash 20c79b3
Delete 'I' from I<module>Commands intances in the examples
shacharPash 6c96b6e
change to Uppercase
shacharPash 8d0cd45
fixex after vlad's review
shacharPash dd50d99
Merge branch 'master' into ftSearchCommands
shacharPash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using NRedisStack.Search.Literals; | ||
namespace NRedisStack.Search | ||
{ | ||
public class FTSpellCheckParams | ||
{ | ||
List<object> args = new List<object>(); | ||
private List<KeyValuePair<string, string>> terms = new List<KeyValuePair<string, string>>(); | ||
private int? distance = null; | ||
private int? dialect = null; | ||
|
||
public FTSpellCheckParams() { } | ||
|
||
/// <summary> | ||
/// Specifies an inclusion (INCLUDE) of a custom dictionary. | ||
/// </summary> | ||
public FTSpellCheckParams IncludeTerm(string dict) | ||
{ | ||
return AddTerm(dict, SearchArgs.INCLUDE); | ||
shacharPash marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/// <summary> | ||
/// Specifies an inclusion (EXCLUDE) of a custom dictionary. | ||
/// </summary> | ||
public FTSpellCheckParams ExcludeTerm(string dict) | ||
{ | ||
return AddTerm(dict, SearchArgs.EXCLUDE); | ||
} | ||
|
||
/// <summary> | ||
/// Specifies an inclusion (INCLUDE) or exclusion (EXCLUDE) of a custom dictionary. | ||
/// </summary> | ||
private FTSpellCheckParams AddTerm(string dict, string type) | ||
{ | ||
terms.Add(new KeyValuePair<string, string>(dict, type)); | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Maximum Levenshtein distance for spelling suggestions (default: 1, max: 4). | ||
/// </summary> | ||
public FTSpellCheckParams Distance(int distance) | ||
{ | ||
this.distance = distance; | ||
return this; | ||
} | ||
|
||
/// <summary> | ||
/// Selects the dialect version under which to execute the query. | ||
/// </summary> | ||
public FTSpellCheckParams Dialect(int dialect) | ||
{ | ||
this.dialect = dialect; | ||
return this; | ||
} | ||
|
||
public List<object> GetArgs() | ||
{ | ||
return args; | ||
} | ||
|
||
public void SerializeRedisArgs() | ||
{ | ||
Distance(); | ||
Terms(); | ||
Dialect(); | ||
} | ||
|
||
private void Dialect() | ||
{ | ||
if (dialect != null) | ||
{ | ||
args.Add(SearchArgs.DIALECT); | ||
args.Add(dialect); | ||
} | ||
} | ||
|
||
private void Terms() | ||
{ | ||
foreach (var term in terms) | ||
{ | ||
args.Add(SearchArgs.TERMS); | ||
args.Add(term.Value); | ||
args.Add(term.Key); | ||
} | ||
} | ||
|
||
private void Distance() | ||
{ | ||
if (distance != null) | ||
{ | ||
args.Add(SearchArgs.DISTANCE); | ||
args.Add(distance); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.