mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	feat: search messages to filter out notifications
This commit is contained in:
		
							parent
							
								
									63d090155c
								
							
						
					
					
						commit
						0559bfb086
					
				@ -377,8 +377,19 @@ func (m *MsgMgo) searchMessageIndex(ctx context.Context, filter any, nextID prim
 | 
				
			|||||||
	if !nextID.IsZero() {
 | 
						if !nextID.IsZero() {
 | 
				
			||||||
		pipeline = append(pipeline, bson.M{"$match": bson.M{"_id": bson.M{"$gt": nextID}}})
 | 
							pipeline = append(pipeline, bson.M{"$match": bson.M{"_id": bson.M{"$gt": nextID}}})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						coarseFilter := bson.M{
 | 
				
			||||||
 | 
							"$or": bson.A{
 | 
				
			||||||
 | 
								bson.M{
 | 
				
			||||||
 | 
									"doc_id": primitive.Regex{Pattern: "^sg_"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								bson.M{
 | 
				
			||||||
 | 
									"doc_id": primitive.Regex{Pattern: "^si_"},
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	pipeline = append(pipeline,
 | 
						pipeline = append(pipeline,
 | 
				
			||||||
		bson.M{"$sort": bson.M{"_id": 1}},
 | 
							bson.M{"$sort": bson.M{"_id": 1}},
 | 
				
			||||||
 | 
							bson.M{"$match": coarseFilter},
 | 
				
			||||||
		bson.M{"$match": filter},
 | 
							bson.M{"$match": filter},
 | 
				
			||||||
		bson.M{"$limit": limit},
 | 
							bson.M{"$limit": limit},
 | 
				
			||||||
		bson.M{
 | 
							bson.M{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user