Created
February 22, 2024 12:46
-
-
Save dragon-dxw/0a3aa35ba776db3944b054dd35e3e55e to your computer and use it in GitHub Desktop.
Marklogic facetting example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xquery version "1.0-ml"; | |
| import module namespace search = | |
| "http://marklogic.com/appservices/search" | |
| at "/MarkLogic/appservices/search/search.xqy"; | |
| let $options := | |
| <search:options> | |
| <search:constraint name="decade"> | |
| <search:range type="xs:date" facet="true"> | |
| <search:bucket ge="2015-01-01" name="recent">recent</search:bucket> | |
| <search:bucket lt="2015-01-01" ge="2010-01-01" | |
| name="older">older</search:bucket> | |
| <search:bucket lt="2010-01-01" | |
| name="old">old</search:bucket> | |
| <search:facet-option>limit=10</search:facet-option> | |
| <search:path-index xmlns:akn="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">akn:judgment/akn:meta/akn:identification/akn:FRBRWork/akn:FRBRdate/@date</search:path-index> | |
| </search:range> | |
| </search:constraint> | |
| <search:constraint name="fakecourt"> | |
| <search:facet-option>limit=10</search:facet-option> | |
| <search:collection prefix="" facet="true"/> (: should be "/court/" to get "/court/ewhc/ch" :) | |
| </search:constraint> | |
| <search:constraint name="court"> | |
| <search:range type="xs:string" facet="true"> | |
| <search:facet-option>limit=10</search:facet-option> | |
| <search:path-index xmlns:akn="http://docs.oasis-open.org/legaldocml/ns/akn/3.0" xmlns:uk="https://caselaw.nationalarchives.gov.uk/akn">//akn:proprietary/uk:court</search:path-index> | |
| </search:range> | |
| </search:constraint> | |
| </search:options> | |
| return | |
| search:search("act", $options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment