Where should I be limiting my results?

前端 未结 1 1355
自闭症患者
自闭症患者 2021-01-28 06:09

What I have done is created an XML file with a list of several thousand search terms that I need to perform on a document. I then created this query, from a sample set of searc

相关标签:
1条回答
  • 2021-01-28 06:27
    let $reults :=
    (
      let $pKeywords := ('best clients', 'Very', '20')
      return
        for $kw in $pKeywords
        return
        (
          /*/entry[contains(comment, concat('!', $kw))],
          /*/entry[contains(comment, $kw)]
        )
      [not(position() gt 2)]
    )
    for $i in (1 to count($results))
    return
    (
      subsequence($results/comment, $i, 1),
      subsequence($results/buyer, $i, 1)
    )
    

    Returns the correct solution:

    <comment>The client is only 20 years old.  Do not be surprised by his youth.</comment>
    <buyer/>
    <comment>Very personable.  One of our best clients.</comment>
    <buyer/>
    <comment>!Very difficult to reach, but one of our top buyers.</comment>
    <buyer/>
    <comment>A bit of an eccentric.  One of our best clients.</comment>
    <buyer/>
    
    0 讨论(0)
提交回复
热议问题