According to the default options defined in search-impl.xqy, you need to
use -:

<starter strength="40" apply="prefix" element="cts:not-query">-</starter>


search:parse("TEST1 - TEST2")


>


<cts:and-query strength="20" qtextjoin="" qtextgroup="( )" xmlns:cts="
http://marklogic.com/cts"xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<cts:word-query qtextref="cts:text">
<cts:text>
TEST1
</cts:text>
</cts:word-query>
<cts:not-query qtextstart="-" strength="40">
<cts:word-query qtextref="cts:text">
<cts:text>
TEST2
</cts:text>
</cts:word-query>
</cts:not-query>

</cts:and-query>


Tested on ML 7.

John


On Tue, Nov 5, 2013 at 7:35 AM, Sundaravadivel Kandasamy <
[email protected]> wrote:

>  Hi All,
>
>                 I used search:parse API and gave the search term 'TEST1 OR
> TEST2'  with options. It recognizes the OR keyword and formed the
> cts:or-query but when I gave NOT keyword it doesn’t recognizes the NOT
> operator. Is there any keyword to specify not query?
>
>
>
> it formed the below query for the search term 'TEST1 OR TEST2'
>
>
>
> <cts:or-query qtextjoin="OR" strength="10" qtextgroup="( )" xmlns:cts="
> http://marklogic.com/cts";>
>
>   <cts:word-query qtextref="cts:text">
>
>     <cts:text>TEST1</cts:text>
>
>     <cts:option>case-insensitive</cts:option>
>
>     <cts:option>diacritic-insensitive</cts:option>
>
>     <cts:option>punctuation-insensitive</cts:option>
>
>   </cts:word-query>
>
>   <cts:word-query qtextref="cts:text">
>
>     <cts:text>TEST2</cts:text>
>
>     <cts:option>case-insensitive</cts:option>
>
>     <cts:option>diacritic-insensitive</cts:option>
>
>     <cts:option>punctuation-insensitive</cts:option>
>
>   </cts:word-query>
>
> </cts:or-query>
>
>
>
> For the search TEST1 NOT TEST2 it formed and query instead of not-query.
>
>
>
> <cts:and-query strength="20" qtextjoin="" qtextgroup="( )" xmlns:cts="
> http://marklogic.com/cts";>
>
>   <cts:word-query qtextref="cts:text">
>
>     <cts:text>TEST1</cts:text>
>
>     <cts:option>case-insensitive</cts:option>
>
>     <cts:option>diacritic-insensitive</cts:option>
>
>     <cts:option>punctuation-insensitive</cts:option>
>
>   </cts:word-query>
>
>   <cts:and-query strength="20" qtextjoin="" qtextgroup="( )">
>
>     <cts:word-query qtextref="cts:text">
>
>       <cts:text>NOT</cts:text>
>
>       <cts:option>case-insensitive</cts:option>
>
>       <cts:option>diacritic-insensitive</cts:option>
>
>       <cts:option>punctuation-insensitive</cts:option>
>
>     </cts:word-query>
>
>     <cts:word-query qtextref="cts:text">
>
>       <cts:text>TEST2</cts:text>
>
>       <cts:option>case-insensitive</cts:option>
>
>       <cts:option>diacritic-insensitive</cts:option>
>
>       <cts:option>punctuation-insensitive</cts:option>
>
>     </cts:word-query>
>
>   </cts:and-query>
>
> </cts:and-query>
>
>
>
> Regards,
>
> Sundar.
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
> for the use of the addressee(s). If you are not the intended recipient, please
> notify the sender by e-mail and delete the original message. Further, you are 
> not
> to copy, disclose, or distribute this e-mail or its contents to any other 
> person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys has 
> taken
> every reasonable precaution to minimize this risk, but is not liable for any 
> damage
> you may sustain as a result of any virus in this e-mail. You should carry out 
> your
> own virus checks before opening the e-mail or attachment. Infosys reserves the
> right to monitor and review the content of all messages sent to or from this 
> e-mail
> address. Messages sent to or from this e-mail address may be stored on the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to