| @@ -160,9 +160,12 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string) *SearchRes { | |||
| record := make(map[string]interface{}) | |||
| record["name"] = recordSource["name"] | |||
| record["owner_name"] = recordSource["owner_name"] | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| if recordSource["description"] != nil { | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| } else { | |||
| record["description"] = "" | |||
| } | |||
| record["num_watches"] = recordSource["num_watches"] | |||
| record["num_stars"] = recordSource["num_stars"] | |||
| @@ -279,9 +282,12 @@ func makeUserOrOrgResult(sRes *elastic.SearchResult, Key string, ctx *context.Co | |||
| record := make(map[string]interface{}) | |||
| record["name"] = recordSource["name"] | |||
| record["full_name"] = recordSource["full_name"] | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| if recordSource["description"] != nil { | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| } else { | |||
| record["description"] = "" | |||
| } | |||
| if ctx.User != nil { | |||
| record["email"] = recordSource["email"] | |||
| } else { | |||
| @@ -383,8 +389,12 @@ func makeDatasetResult(sRes *elastic.SearchResult, Key string) *SearchRes { | |||
| } | |||
| record["title"] = recordSource["title"] | |||
| record["category"] = recordSource["category"] | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| if recordSource["description"] != nil { | |||
| desc := recordSource["description"].(string) | |||
| record["description"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| } else { | |||
| record["description"] = "" | |||
| } | |||
| record["download_times"] = recordSource["download_times"] | |||
| record["created_unix"] = recordSource["created_unix"] | |||
| result = append(result, record) | |||
| @@ -465,14 +475,21 @@ func makeIssueResult(sRes *elastic.SearchResult, Key string) *SearchRes { | |||
| } | |||
| } | |||
| record["name"] = recordSource["name"] | |||
| desc := recordSource["content"].(string) | |||
| record["content"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| if recordSource["content"] != nil { | |||
| desc := recordSource["content"].(string) | |||
| record["content"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| } else { | |||
| record["content"] = "" | |||
| } | |||
| if recordSource["pr_id"] != nil { | |||
| record["pr_id"] = recordSource["pr_id"] | |||
| } | |||
| desc = recordSource["comment"].(string) | |||
| record["comment"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| if recordSource["comment"] != nil { | |||
| desc := recordSource["comment"].(string) | |||
| record["comment"] = dealLongText(desc, Key, hit.MatchedQueries) | |||
| } else { | |||
| record["comment"] = "" | |||
| } | |||
| record["num_comments"] = recordSource["num_comments"] | |||
| record["updated_unix"] = recordSource["updated_unix"] | |||
| result = append(result, record) | |||