Hi Dave,
    That didn't work either. Find below the code and response.

import module namespace search ="http://marklogic.com/appservices/search";
    at "/MarkLogic/appservices/search/search.xqy";
let $options := <options xmlns="http://marklogic.com/appservices/search";>
   
   <constraint xmlns = "http://marklogic.com/appservices/search"; name="date">
                <range type="xs:gYear" facet="true">
                        <bucket lt="1930" ge="1920" name="1920s">1920s</bucket>
                        <bucket lt="1940" ge="1930" name="1930s">1930s</bucket>
                        <bucket lt="1950" ge="1940" name="1940s">1940s</bucket>
                        <bucket lt="1960" ge="1950" name="1950s">1950s</bucket>
                        <bucket lt="1970" ge="1960" name="1960s">1960s</bucket>
                        <bucket lt="1980" ge="1970" name="1970s">1970s</bucket>
                        <bucket lt="1990" ge="1980" name="1980s">1980s</bucket>
                        <bucket lt="2000" ge="1990" name="1990s">1990s</bucket>
                        <bucket ge="2000" name="2000s">2000s</bucket>
                        <facet-option>limit=15</facet-option>                   
                        <element ns="XXXXXXXX" name="history-date"/>      
                </range>
        </constraint>   
   <additional-query 
xmlns="http://marklogic.com/appservices/search";><cts:collection-query 
xmlns:cts="http://marklogic.com/cts";>
       <cts:uri>ALL</cts:uri>
     </cts:collection-query></additional-query>
   <return-results>true</return-results>
   <return-facets>true</return-facets>
   <term>
     <term-option>unstemmed</term-option>
   </term>
 </options>

    return search:search('date LT 2000',$options)

<search:response snippet-format="snippet" total="0" start="1" page-length="10" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="" 
xmlns:search="http://marklogic.com/appservices/search";>
<search:facet name="date"/>
<search:qtext>date LT 2000</search:qtext>
<search:warning id="SEARCH-IGNOREDQTEXT">[date LT 2000]</search:warning>
<search:metrics>
<search:query-resolution-time>PT0.003679S</search:query-resolution-time>
<search:facet-resolution-time>PT0.000098S</search:facet-resolution-time>
<search:snippet-resolution-time>PT0S</search:snippet-resolution-time>
<search:total-time>PT0.004136S</search:total-time>
</search:metrics>
</search:response>

Thanks,
Diwakar N




________________________________________
From: [email protected] 
<[email protected]> on behalf of 
[email protected] 
<[email protected]>
Sent: 26 November 2014 20:24
To: [email protected]
Subject: General Digest, Vol 125, Issue 42

Send General mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of General digest..."


Today's Topics:

   1. Re: Relational operators on contraints (Dave Cassel)


----------------------------------------------------------------------

Message: 1
Date: Wed, 26 Nov 2014 14:54:04 +0000
From: Dave Cassel <[email protected]>
Subject: Re: [MarkLogic Dev General] Relational operators on
        contraints
To: MarkLogic Developer Discussion <[email protected]>
Message-ID: <d09b5333.802bb%[email protected]>
Content-Type: text/plain; charset="us-ascii"

The docs talk about comparing to values, but don't address buckets. Does this 
work?

search:search('date LT 2000', $options)

Note that I'm using the value "2000" rather than the bucket "2000s".

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
Cell:  +1-484-798-8720


From: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Wednesday, November 26, 2014 at 9:32 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] Relational operators on contraints


Hi Dave,
                I did try inequality operators earlier as well. But it did not 
work out. Please find the scr.shot.

Thanks,
Diwakar N



________________________________________
From: 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
 on behalf of 
[email protected]<mailto:[email protected]>
 
<[email protected]<mailto:[email protected]>>
Sent: 26 November 2014 19:13
To: [email protected]<mailto:[email protected]>
Subject: General Digest, Vol 125, Issue 40

Send General mailing list submissions to
        [email protected]<mailto:[email protected]>

To subscribe or unsubscribe via the World Wide Web, visit
        http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
        
[email protected]<mailto:[email protected]>

You can reach the person managing the list at
        
[email protected]<mailto:[email protected]>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of General digest..."


Today's Topics:

   1. Relational operators on contraints
      ([email protected]<mailto:[email protected]>)
   2. Re: Relational operators on contraints (Dave Cassel)


----------------------------------------------------------------------

Message: 1
Date: Wed, 26 Nov 2014 07:10:17 +0000
From: <[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] Relational operators on contraints
To: <[email protected]<mailto:[email protected]>>
Message-ID: 
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

     I have created bucketed contraint as below on a date tag and i have 
created range index for the same. All i could use is ':' operator on the 
constraint while doing search. Am not able to using any relational operators.


let $options := <options xmlns="http://marklogic.com/appservices/search";>
                <return-results>false</return-results>
                  <constraint xmlns = "http://marklogic.com/appservices/search"; 
name="date">
        <range type="xs:gYear" facet="true">
            <bucket lt="1930" ge="1920" name="1920s">1920s</bucket>
            <bucket lt="1940" ge="1930" name="1930s">1930s</bucket>
            <bucket lt="1950" ge="1940" name="1940s">1940s</bucket>
            <bucket lt="1960" ge="1950" name="1950s">1950s</bucket>
            <bucket lt="1970" ge="1960" name="1960s">1960s</bucket>
            <bucket lt="1980" ge="1970" name="1970s">1970s</bucket>
            <bucket lt="1990" ge="1980" name="1980s">1980s</bucket>
            <bucket lt="2000" ge="1990" name="1990s">1990s</bucket>
            <bucket ge="2000" name="2000s">2000s</bucket>
            <facet-option>limit=15</facet-option>
            <element ns="http://dtd.cambridge.org/2007/CBML"; 
name="history-date"/>
        </range>
    </constraint>
  </options>


for ex:

                search:search('date:1990s',$options) is working fine. But



                search:search('date lt 2000s',$options) or

                search:search('date lt 2000s AND gt 1980s',$options) e.t.c are 
not working at all.


Please let me know the correct way of using relational operators in 
search:search.


Thanks,

Diwakar N

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20141126/1b521c28/attachment-0001.html

------------------------------

Message: 2
Date: Wed, 26 Nov 2014 13:43:45 +0000
From: Dave Cassel <[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] Relational operators on
        contraints
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Message-ID: 
<d09b42de.80249%[email protected]<mailto:d09b42de.80249%[email protected]>>
Content-Type: text/plain; charset="us-ascii"

Hi Diwakar,

The default Search API's grammar uses LT, LE, GT, and GE for 
inequalities<http://docs.marklogic.com/guide/search-dev/string-query#id_23164>, 
so something like "date LT 2000s ought to work.

Dave.

--
Dave Cassel
Developer Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
Cell:  +1-484-798-8720


From: 
"[email protected]<mailto:[email protected]><mailto:[email protected]>"
 
<[email protected]<mailto:[email protected]><mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]><mailto:[email protected]>>
Date: Wednesday, November 26, 2014 at 2:10 AM
To: 
"[email protected]<mailto:[email protected]><mailto:[email protected]>"
 
<[email protected]<mailto:[email protected]><mailto:[email protected]>>
Subject: [MarkLogic Dev General] Relational operators on contraints


Hi,

     I have created bucketed contraint as below on a date tag and i have 
created range index for the same. All i could use is ':' operator on the 
constraint while doing search. Am not able to using any relational operators.


let $options := <options xmlns="http://marklogic.com/appservices/search";>
                <return-results>false</return-results>
                  <constraint xmlns = "http://marklogic.com/appservices/search"; 
name="date">
        <range type="xs:gYear" facet="true">
            <bucket lt="1930" ge="1920" name="1920s">1920s</bucket>
            <bucket lt="1940" ge="1930" name="1930s">1930s</bucket>
            <bucket lt="1950" ge="1940" name="1940s">1940s</bucket>
            <bucket lt="1960" ge="1950" name="1950s">1950s</bucket>
            <bucket lt="1970" ge="1960" name="1960s">1960s</bucket>
            <bucket lt="1980" ge="1970" name="1970s">1970s</bucket>
            <bucket lt="1990" ge="1980" name="1980s">1980s</bucket>
            <bucket lt="2000" ge="1990" name="1990s">1990s</bucket>
            <bucket ge="2000" name="2000s">2000s</bucket>
            <facet-option>limit=15</facet-option>
            <element ns="http://dtd.cambridge.org/2007/CBML"; 
name="history-date"/>
        </range>
    </constraint>
  </options>


for ex:

                search:search('date:1990s',$options) is working fine. But



                search:search('date lt 2000s',$options) or

                search:search('date lt 2000s AND gt 1980s',$options) e.t.c are 
not working at all.


Please let me know the correct way of using relational operators in 
search:search.


Thanks,

Diwakar N

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20141126/1321ca8d/attachment.html

------------------------------

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 125, Issue 40
****************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://developer.marklogic.com/pipermail/general/attachments/20141126/cd1cb904/attachment.html

------------------------------

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general


End of General Digest, Vol 125, Issue 42
****************************************
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to