Повысить счет в поиске: искать дополнительный запрос - PullRequest
0 голосов
/ 07 ноября 2019

Я пытаюсь получить более релевантные результаты, добавив вес к cts:element-value-query в моем файле опций поиска.

Мой вариант использования - это предоставление мне всех документов, соответствующих критериям поиска, и повышениедокументы, если они имеют taxonomy-id = 9606.

Ниже приведены мои варианты

<options xmlns="http://marklogic.com/appservices/search">
    <additional-query>
        <cts:and-query xmlns:cts="http://marklogic.com/cts">
            <cts:collection-query>
                <cts:uri>http://rdf.abbvienet.com/entity/target</cts:uri>
            </cts:collection-query>
            <cts:or-query>
              <cts:element-value-query weight="64">
                <cts:element xmlns:target-species="http://schemas.abbvienet.com/entity/target/species">target-species:taxonomy-id</cts:element>
                <cts:text xml:lang="en">9606</cts:text>
              </cts:element-value-query>
              <cts:not-query>
                <cts:element-value-query weight="-16">
                  <cts:element xmlns:target-species="http://schemas.abbvienet.com/entity/target/species">target-species:taxonomy-id</cts:element>
                  <cts:text xml:lang="en">9606</cts:text>
                </cts:element-value-query>
              </cts:not-query>
            </cts:or-query>
        </cts:and-query>
    </additional-query>
    <constraint name="gs">
      <word>
          <element ns="http://schemas.abbvienet.com/entity/target" name="gene-symbol"/>
          <weight>25.0</weight>
      </word>
    </constraint>
        <constraint name="gas">
      <word>
           <element ns="http://schemas.abbvienet.com/entity/target" name="gene-alternate-symbols"/>
          <weight>20.0</weight>
      </word>
    </constraint>
        <constraint name="eid">
      <word>
         <element ns="http://schemas.abbvienet.com/entity/target" name="entrezgene-id"/>
          <weight>64.0</weight>
      </word>
    </constraint>
        <constraint name="gn">
      <word>
          <element ns="http://schemas.abbvienet.com/entity/target" name="gene-name"/>
          <weight>2.0</weight>
      </word>
    </constraint>
        <constraint name="pn">
      <word>
          <element ns="http://schemas.abbvienet.com/entity/target/protein" name="protein:name"/>
      </word>
    </constraint>
    <term>
        <term-option>case-insensitive</term-option>
        <term-option>punctuation-insensitive</term-option>
        <term-option>whitespace-insensitive</term-option>
        <term-option>wildcarded</term-option>
    </term>

Когда я выполняю следующий поиск

let $q := '((gs:BTK) OR (gas:BTK) OR (eid:BTK) OR (gn:BTK) OR (pn:BTK))'
return
 search:search($q, $options)   

По некоторым причинам результаты сtaxonomy-id=9606 не отображаются сверху ... Если это не правильный путь, как мне это сделать?

...