Skip to content

Commit

Permalink
add FullTextContains quick search type (simple version of pull request
Browse files Browse the repository at this point in the history
…serenity-is#2200 that only support quick search with contains for performance reasons, thanks @marcobisio)
  • Loading branch information
volkanceylan committed Oct 12, 2017
1 parent acab19d commit 8d73e23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Serenity.Data/Mapping/SearchType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum SearchType
Auto = 0,
Equals = 1,
Contains = 2,
StartsWith = 3
StartsWith = 3,
FullTextContains = 4
}
}
4 changes: 4 additions & 0 deletions Serenity.Services/RequestHandlers/List/ListRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ protected virtual void AddFieldContainsCriteria(Field field, string containsText
criteria |= new Criteria(field).Contains(containsText);
break;

case SearchType.FullTextContains:
criteria |= new Criteria("CONTAINS(" + field.Expression + ", " + containsText.ToSql() + ")");
break;

case SearchType.StartsWith:
criteria |= new Criteria(field).StartsWith(containsText);
break;
Expand Down

0 comments on commit 8d73e23

Please sign in to comment.