sb.Append(" { ");
sb.Append(" ");
sb.Append(" \"query\" : { ");
sb.Append("\"function_score\": {\"query\":{ ");//分值改进函数
sb.Append(" \"bool\": { ");
sb.Append(" \"must\": [ ");
sb.Append(" { ");
sb.Append(" \"match\": { \"_all\": \"" + _all + "\"} ");
sb.Append(" } ");
sb.Append(" ], ");
sb.Append(" \"must_not\": [ ");
sb.Append(" { ");
sb.Append(" \"term\": { \"EnterpriseName\": \"" + companyName + "\"} ");
sb.Append(" } ");
sb.Append(" ], ");
sb.Append(" \"must_not\": [ ");
sb.Append(" {\"has_child\" : { ");
sb.Append(" \"type\" : \"enterpriseusermap\", ");
sb.Append(" \"query\" :{ ");
sb.Append(" \"bool\": { ");
sb.Append(" \"should\": [ ");
//sb.Append(" {\"term\" :{ \"UserGuid\":\"" + UserGuid + "\"}}, ");
sb.Append(" {\"term\": {\"CompanyGuid\": \"" + CompanyGuid + "\"}} ");
sb.Append(" ] ");
sb.Append(" } ");
sb.Append(" } ");
sb.Append(" } ");
sb.Append(" } ");
sb.Append(" ] ");
sb.Append(" } ");
sb.Append("},\"script_score\" : {\"script\" : \"_score \"}}");//* doc['DataQualityValue'].value*doc['DataYear'].value 分值改进函数
sb.Append(" },\"from\": " + from + ", \"size\": " + size + ", ");
sb.Append(" \"highlight\" : { ");
sb.Append(" \"pre_tags\" : [\"<tag1>\", \"<tag2>\"], ");
sb.Append(" \"post_tags\" : [\"</tag1>\", \"</tag2>\"], ");
sb.Append(" \"fields\" : { ");
sb.Append(" \"EnterpriseName\" : {} ");
sb.Append(" } ");
sb.Append(" } ");
sb.Append(" }
ElasticSearch
最新推荐文章于 2024-07-08 06:53:03 发布