1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-06-02 21:31:23 +00:00
This commit is contained in:
Chongyi Zheng 2024-04-28 23:22:15 -04:00
parent 2341d5d99d
commit 44ed7867fa
No known key found for this signature in database
GPG Key ID: 4B90B77407DA2359
2 changed files with 40 additions and 44 deletions

View File

@ -56,22 +56,20 @@ func NewIndexer(url, indexerName string) *Indexer {
return indexer
}
var (
defaultMapping = &types.TypeMapping{
Properties: map[string]types.Property{
"repo_id": types.NewLongNumberProperty(),
"content": &types.TextProperty{
Fields: make(map[string]types.Property, 0),
Meta: make(map[string]string, 0),
Properties: make(map[string]types.Property, 0),
TermVector: &termvectoroption.Withpositions,
},
"commit_id": types.NewKeywordProperty(),
"language": types.NewKeywordProperty(),
"updated_at": types.NewLongNumberProperty(),
var defaultMapping = &types.TypeMapping{
Properties: map[string]types.Property{
"repo_id": types.NewLongNumberProperty(),
"content": &types.TextProperty{
Fields: make(map[string]types.Property, 0),
Meta: make(map[string]string, 0),
Properties: make(map[string]types.Property, 0),
TermVector: &termvectoroption.Withpositions,
},
}
)
"commit_id": types.NewKeywordProperty(),
"language": types.NewKeywordProperty(),
"updated_at": types.NewLongNumberProperty(),
},
}
func (b *Indexer) addUpdate(ctx context.Context, blk *bulk.Bulk, batchWriter git.WriteCloserError, batchReader *bufio.Reader, sha string, update internal.FileUpdate, repo *repo_model.Repository) error {
// Ignore vendored files in code search

View File

@ -47,37 +47,35 @@ func NewIndexer(url, indexerName string) *Indexer {
return indexer
}
var (
defaultMapping = &types.TypeMapping{
Properties: map[string]types.Property{
"id": types.NewIntegerNumberProperty(),
"repo_id": types.NewIntegerNumberProperty(),
"is_public": types.NewBooleanProperty(),
var defaultMapping = &types.TypeMapping{
Properties: map[string]types.Property{
"id": types.NewIntegerNumberProperty(),
"repo_id": types.NewIntegerNumberProperty(),
"is_public": types.NewBooleanProperty(),
"title": types.NewTextProperty(),
"content": types.NewTextProperty(),
"comments": types.NewTextProperty(),
"title": types.NewTextProperty(),
"content": types.NewTextProperty(),
"comments": types.NewTextProperty(),
"is_pull": types.NewBooleanProperty(),
"is_closed": types.NewBooleanProperty(),
"label_ids": types.NewIntegerNumberProperty(),
"no_label": types.NewBooleanProperty(),
"milestone_id": types.NewIntegerNumberProperty(),
"project_id": types.NewIntegerNumberProperty(),
"project_board_id": types.NewIntegerNumberProperty(),
"poster_id": types.NewIntegerNumberProperty(),
"assignee_id": types.NewIntegerNumberProperty(),
"mention_ids": types.NewIntegerNumberProperty(),
"reviewed_ids": types.NewIntegerNumberProperty(),
"review_requested_ids": types.NewIntegerNumberProperty(),
"subscriber_ids": types.NewIntegerNumberProperty(),
"updated_unix": types.NewIntegerNumberProperty(),
"created_unix": types.NewIntegerNumberProperty(),
"deadline_unix": types.NewIntegerNumberProperty(),
"comment_count": types.NewIntegerNumberProperty(),
},
}
)
"is_pull": types.NewBooleanProperty(),
"is_closed": types.NewBooleanProperty(),
"label_ids": types.NewIntegerNumberProperty(),
"no_label": types.NewBooleanProperty(),
"milestone_id": types.NewIntegerNumberProperty(),
"project_id": types.NewIntegerNumberProperty(),
"project_board_id": types.NewIntegerNumberProperty(),
"poster_id": types.NewIntegerNumberProperty(),
"assignee_id": types.NewIntegerNumberProperty(),
"mention_ids": types.NewIntegerNumberProperty(),
"reviewed_ids": types.NewIntegerNumberProperty(),
"review_requested_ids": types.NewIntegerNumberProperty(),
"subscriber_ids": types.NewIntegerNumberProperty(),
"updated_unix": types.NewIntegerNumberProperty(),
"created_unix": types.NewIntegerNumberProperty(),
"deadline_unix": types.NewIntegerNumberProperty(),
"comment_count": types.NewIntegerNumberProperty(),
},
}
// Index will save the index data
func (b *Indexer) Index(ctx context.Context, issues ...*internal.IndexerData) error {