when I use constraints with boot query, then boost is being ignored.. following is my options file
let $options :=
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="gs">
<value>
<element ns="http://xxxx/entity/target" name="gene-symbol"/>
</value>
</constraint>
<constraint name="taxid">
<value>
<element ns="http://xxx/entity/target/species" name="taxonomy-id"/>
</value>
</constraint>
<constraint name="search-text">
<custom facet="false">
<parse apply="parse-string"
ns="http://xxx/xxx/custom-constraints/dads/dadsAutosuggestConstraint"
at="/lib/custom-constraints/dads/dadsAutosuggestConstraint.xqy"/>
</custom>
</constraint>
<term>
<default ref="search-text" />
<term-option>case-insensitive</term-option>
<term-option>punctuation-insensitive</term-option>
<term-option>whitespace-insensitive</term-option>
<term-option>wildcarded</term-option>
</term>
</options>
when I do
let $q := 'gs:PARP1 BOOST (taxid:9606)'
the boost is ignored .. but when do without constraint
let $q := 'PARP1 BOOST (taxid:9606)'
it works like expected..
How can I make it work with constraints
as well
**** UPDATED with search plan ******
<search:plan>
<qry:query-plan xmlns:qry="http://marklogic.com/cts/query">
<qry:expr-trace>impl:apply-search(map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), "xdmp:plan", fn:false())</qry:expr-trace>
<qry:info-trace>Analyzing path for search: fn:collection()</qry:info-trace>
<qry:info-trace>Step 1 is searchable: fn:collection()</qry:info-trace>
<qry:info-trace>Path is fully searchable.</qry:info-trace>
<qry:info-trace>Gathering constraints.</qry:info-trace>
<qry:elem-word-trace text="PARP1" elem-name="gene-symbol" elem-uri="http://schemas.abbvienet.com/entity/target">
<qry:key>4322900364588965241</qry:key>
</qry:elem-word-trace>
<qry:info-trace>Search query contributed 1 constraint: cts:boost-query(cts:element-word-query(fn:QName("http://schemas.abbvienet.com/entity/target","gene-symbol"), "PARP1", ("lang=en"), 1), cts:element-value-query(fn:QName("http://schemas.abbvienet.com/entity/target/species","taxonomy-id"), "9606", ("lang=en"), 1))</qry:info-trace>
<qry:partial-plan>
<qry:and-two-queries ordered="true">
<qry:term-query weight="1">
<qry:key>4322900364588965241</qry:key>
<qry:annotation>element(http://schemas.abbvienet.com/entity/target:gene-symbol,word("PARP1"))</qry:annotation>
</qry:term-query>
<qry:or-two-queries>
<qry:term-query weight="1">
<qry:key>3406225445527486620</qry:key>
<qry:annotation>element(taxonomy-id,value("9606"))</qry:annotation>
</qry:term-query>
<qry:and-query ordered="true"/>
</qry:or-two-queries>
</qry:and-two-queries>
</qry:partial-plan>
<qry:info-trace>Executing search.</qry:info-trace>
<qry:ordering/>
<qry:final-plan>
<qry:and-query>
<qry:and-two-queries ordered="true">
<qry:term-query weight="1">
<qry:key>4322900364588965241</qry:key>
<qry:annotation>element(http://schemas.abbvienet.com/entity/target:gene-symbol,word("PARP1"))</qry:annotation>
</qry:term-query>
<qry:or-two-queries>
<qry:term-query weight="1">
<qry:key>3406225445527486620</qry:key>
<qry:annotation>element(taxonomy-id,value("9606"))</qry:annotation>
</qry:term-query>
<qry:and-query ordered="true"/>
</qry:or-two-queries>
</qry:and-two-queries>
</qry:and-query>
</qry:final-plan>
<qry:info-trace>Selected 6 fragments to filter</qry:info-trace>
<qry:result estimate="6"/>
</qry:query-plan>
</search:plan>
If anyone is interested..once I changed the scoring to score-simple
it worked. Added the following to my search-options
<search-option>score-simple</search-option>
By default it was doing logft
and this was causing issues..
fyi: <search-option>relevance-trace</search-option>
this option will tell you how the scores are being calculated