Php Mongodb中带条件的文本搜索

Php Mongodb中带条件的文本搜索,php,mongodb,Php,Mongodb,我有下面的场景,其中,我有一个集合“演示”,包含所有需要搜索的数据, 我使用了文本搜索 { "_id" : "1", "type" : "Deal", "description_title" : "New Deal for test", "images" : "", "start_date" : ISODate("2017-07-20T00:00:00.000+0000"), "end_date" : ISODate("2017-10-3

我有下面的场景,其中,我有一个集合“演示”,包含所有需要搜索的数据, 我使用了文本搜索

{
    "_id" : "1", 
    "type" : "Deal", 
    "description_title" : "New Deal for test", 
    "images" : "", 
    "start_date" : ISODate("2017-07-20T00:00:00.000+0000"), 
    "end_date" : ISODate("2017-10-30T11:59:00.000+0000"), 
    "status" : "1"
}
{
    "_id" : "2", 
    "type" : "Event", 
    "description_title" : "Event1 test", 
    "images" : "", 
    "end_date" : ISODate("2017-10-20T00:00:00.000+0000")
    "status" : "1"
}
{
    "_id" : "3", 
    "type" : "Text", 
    "description_title" : "test", 
    "images" : "",
    "status" : "1"
}
{
    "_id" : "4", 
    "type" : "Event", 
    "description_title" : "Event2 test", 
    "images" : "", 
    "end_date" : ISODate("2017-07-20T00:00:00.000+0000")
    "status" : "1"
}
在上述集合中,我已存储了所有需要使用文本搜索进行搜索的数据,但当
“键入”:“事件”/“交易”
时,它应仅返回活动交易和事件
“当前日期小于结束日期”
需要搜索。 在上面的集合中,当我搜索“Test”时,它应该返回

{
    "_id" : "1", 
    "type" : "Deal", 
    "description_title" : "New Deal for test", 
    "images" : "", 
    "start_date" : ISODate("2017-07-20T00:00:00.000+0000"), 
    "end_date" : ISODate("2017-10-30T11:59:00.000+0000"), 
    "status" : "1"
}
{
    "_id" : "2", 
    "type" : "Event", 
    "description_title" : "Event1 test", 
    "images" : "", 
    "end_date" : ISODate("2017-10-20T00:00:00.000+0000")
    "status" : "1"
}
{
    "_id" : "3", 
    "type" : "Text", 
    "description_title" : "test", 
    "images" : "",
    "status" : "1"
}
我使用了下面的查询,但它给出了所有结果

    db.demo.find({'$text' : {'$search' => 'test'},'$or' : {
    {"type" : "Deal","end_date" : {'$gte' : ISODate("2017-09-14T11:59:00.000+0000") }},
    {"type" : "Text"},
{"type" : "Event","end_date" : {'$gte' : ISODate("2017-09-14T11:59:00.000+0000") }},
    }})
上面的查询返回所有记录。
请帮助我实现我的结果。

使用textScore,在最终使用限制(1)中,通过这样做,您将得到1份完全匹配的文档。检查doc use textScore和最终使用限制(1),通过这样做,您将得到1个完全匹配的文档。检查文件