summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/help/Search.md12
-rw-r--r--model/channel.go7
-rw-r--r--model/oauth.go3
-rw-r--r--model/post.go7
-rw-r--r--model/preference.go3
-rw-r--r--model/team.go3
-rw-r--r--model/user.go7
7 files changed, 25 insertions, 17 deletions
diff --git a/doc/help/Search.md b/doc/help/Search.md
index 02ecf7d40..51095aac6 100644
--- a/doc/help/Search.md
+++ b/doc/help/Search.md
@@ -2,14 +2,16 @@
The search box in Mattermost brings back results from any channel of which you’re a member. No results are returned from channels where you are not a member - even if they are open channels.
-Some things to know about search:
+#### Some things to know about search:
- Multiple search terms are connected with “OR” by default. Typing in `Mattermost website` returns results containing “Mattermost” or “website”
-- You can use quotes to return search results for exact terms, like `"Mattermost website"` will only return messages containing the entire phrase `"Mattermost website"` and not return messages with only `Mattermost` or `website`
-- You can use the `*` character for wildcard searches that match within words. For example: Searching for `rea*` brings back messages containing `reach`, `reason` and other words starting with `rea`.
+- Use `from:` to find posts from specific users and `in:` to find posts in specific channels. For example: Searching `Mattermost in:town-square` only returns messages in Town Square that contain `Mattermost`
+- Use quotes to return search results for exact terms. For example: Searching `"Mattermost website"` returns messages containing the entire phrase `"Mattermost website"` and not messages containing only `Mattermost` or `website`
+- Use the `*` character for wildcard searches that match within words. For example: Searching for `rea*` brings back messages containing `reach`, `reason` and other words starting with `rea`.
-#### Limitations
+#### Limitations:
- Search in Mattermost uses the full text search features included in either a MySQL or Postgres database, which has some limitations
- Special cases that are not supported in default full text search, such as searching for IP addresses like `10.100.200.101`, can be added in future as the search feature evolves
- - Searches with fewer than three characters will return no results, so for searching in Chinese try adding * to the end of queries
+ - Two letter searches and common words like "this", "a" and "is" won't appear in search results
+ - For searching in Chinese try adding * to the end of queries
diff --git a/model/channel.go b/model/channel.go
index ac54a7e44..0ce09f4bc 100644
--- a/model/channel.go
+++ b/model/channel.go
@@ -6,6 +6,7 @@ package model
import (
"encoding/json"
"io"
+ "unicode/utf8"
)
const (
@@ -74,7 +75,7 @@ func (o *Channel) IsValid() *AppError {
return NewAppError("Channel.IsValid", "Update at must be a valid time", "id="+o.Id)
}
- if len(o.DisplayName) > 64 {
+ if utf8.RuneCountInString(o.DisplayName) > 64 {
return NewAppError("Channel.IsValid", "Invalid display name", "id="+o.Id)
}
@@ -90,11 +91,11 @@ func (o *Channel) IsValid() *AppError {
return NewAppError("Channel.IsValid", "Invalid type", "id="+o.Id)
}
- if len(o.Header) > 1024 {
+ if utf8.RuneCountInString(o.Header) > 1024 {
return NewAppError("Channel.IsValid", "Invalid header", "id="+o.Id)
}
- if len(o.Purpose) > 128 {
+ if utf8.RuneCountInString(o.Purpose) > 128 {
return NewAppError("Channel.IsValid", "Invalid purpose", "id="+o.Id)
}
diff --git a/model/oauth.go b/model/oauth.go
index 0320e7ec7..67825dd97 100644
--- a/model/oauth.go
+++ b/model/oauth.go
@@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
+ "unicode/utf8"
)
type OAuthApp struct {
@@ -57,7 +58,7 @@ func (a *OAuthApp) IsValid() *AppError {
return NewAppError("OAuthApp.IsValid", "Invalid homepage", "app_id="+a.Id)
}
- if len(a.Description) > 512 {
+ if utf8.RuneCountInString(a.Description) > 512 {
return NewAppError("OAuthApp.IsValid", "Invalid description", "app_id="+a.Id)
}
diff --git a/model/post.go b/model/post.go
index 11f3ad0d5..e0074b348 100644
--- a/model/post.go
+++ b/model/post.go
@@ -6,6 +6,7 @@ package model
import (
"encoding/json"
"io"
+ "unicode/utf8"
)
const (
@@ -94,11 +95,11 @@ func (o *Post) IsValid() *AppError {
return NewAppError("Post.IsValid", "Invalid original id", "")
}
- if len(o.Message) > 4000 {
+ if utf8.RuneCountInString(o.Message) > 4000 {
return NewAppError("Post.IsValid", "Invalid message", "id="+o.Id)
}
- if len(o.Hashtags) > 1000 {
+ if utf8.RuneCountInString(o.Hashtags) > 1000 {
return NewAppError("Post.IsValid", "Invalid hashtags", "id="+o.Id)
}
@@ -106,7 +107,7 @@ func (o *Post) IsValid() *AppError {
return NewAppError("Post.IsValid", "Invalid type", "id="+o.Type)
}
- if len(ArrayToJson(o.Filenames)) > 4000 {
+ if utf8.RuneCountInString(ArrayToJson(o.Filenames)) > 4000 {
return NewAppError("Post.IsValid", "Invalid filenames", "id="+o.Id)
}
diff --git a/model/preference.go b/model/preference.go
index 44279f71a..bcd0237f1 100644
--- a/model/preference.go
+++ b/model/preference.go
@@ -6,6 +6,7 @@ package model
import (
"encoding/json"
"io"
+ "unicode/utf8"
)
const (
@@ -52,7 +53,7 @@ func (o *Preference) IsValid() *AppError {
return NewAppError("Preference.IsValid", "Invalid name", "name="+o.Name)
}
- if len(o.Value) > 128 {
+ if utf8.RuneCountInString(o.Value) > 128 {
return NewAppError("Preference.IsValid", "Value is too long", "value="+o.Value)
}
diff --git a/model/team.go b/model/team.go
index 5c9cf5a26..e7dde4766 100644
--- a/model/team.go
+++ b/model/team.go
@@ -9,6 +9,7 @@ import (
"io"
"regexp"
"strings"
+ "unicode/utf8"
)
const (
@@ -122,7 +123,7 @@ func (o *Team) IsValid(restrictTeamNames bool) *AppError {
return NewAppError("Team.IsValid", "Invalid email", "id="+o.Id)
}
- if len(o.DisplayName) == 0 || len(o.DisplayName) > 64 {
+ if utf8.RuneCountInString(o.DisplayName) == 0 || utf8.RuneCountInString(o.DisplayName) > 64 {
return NewAppError("Team.IsValid", "Invalid name", "id="+o.Id)
}
diff --git a/model/user.go b/model/user.go
index 15016f8dc..871d1bf2d 100644
--- a/model/user.go
+++ b/model/user.go
@@ -10,6 +10,7 @@ import (
"io"
"regexp"
"strings"
+ "unicode/utf8"
)
const (
@@ -80,15 +81,15 @@ func (u *User) IsValid() *AppError {
return NewAppError("User.IsValid", "Invalid email", "user_id="+u.Id)
}
- if len(u.Nickname) > 64 {
+ if utf8.RuneCountInString(u.Nickname) > 64 {
return NewAppError("User.IsValid", "Invalid nickname", "user_id="+u.Id)
}
- if len(u.FirstName) > 64 {
+ if utf8.RuneCountInString(u.FirstName) > 64 {
return NewAppError("User.IsValid", "Invalid first name", "user_id="+u.Id)
}
- if len(u.LastName) > 64 {
+ if utf8.RuneCountInString(u.LastName) > 64 {
return NewAppError("User.IsValid", "Invalid last name", "user_id="+u.Id)
}