Nest - 如何使用多个子句在查询附近编写跨度?

时间:2015-10-28 00:17:49

标签: elasticsearch nest

我想使用NEST编写查询,如下所述: https://www.elastic.co/guide/en/elasticsearch/reference/1.7/query-dsl-span-near-query.html

我有一组值用作SpanTerm子句。集合大小因查询而异。

如果收藏量有限,我可以这样做:

-std=c11

如何动态完成(未知子句数)?

1 个答案:

答案 0 :(得分:1)

您可以使用此扩展方法:

var terms = new[] {"term1", "term2"};

client.Search<Docuemnt>(s => s
    .Query(q => q
        .SpanNear(sp => sp
            .Slop(12)
            .SpanTermClauses(f => f.Title, terms))));

用法:

 $email=$_POST['email'];   // write multiple emails with comma's    
 $emails=explode(',', $email); // explode email with comma's
     foreach($emails as $one_email)
     {
         $touser=$one_email;
            $subjectAdmin= "subject";
            $headersAdmin = "From: noreply@talentswype.com\r\n";
            $headersAdmin .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $messageuser ='msg here'; 
     $emailSenduser = mail($touser,$subjectAdmin,$messageuser,$headersAdmin);
}

希望它有所帮助。