I wanted to compare two queries:
1)
xdmp:plan(fn:distinct-values(/ts:top-song/ts:genres/ts:genre/text(), "http://marklogic.com/collation/en/S1/AS/T00BB"))
2)
declare variable $options :=
<options xmlns="http://marklogic.com/appservices/search">
<constraint name="genre">
<range type="xs:string" collation="http://marklogic.com/collation/en/S1/AS/T00BB">
<element ns="http://marklogic.com/MLU/top-songs" name="genre"/>
</range>
</constraint>
</options>;
xdmp:plan(search:search("", $options)/search:facet/search:facet-value)
I have the following questions:
In the result for both the queries I get: Expression is unsearchable. Is this a good thing? Does it mean that indexes are already being used and further indexing cannot be done?
(Range index is enabled for genre) I am guessing fn:distict+Xpath uses range indexes but involves filtering due to the Xpath. OTOH search:search uses only value lexicons, so does it do an unfiltered search? If not, is there a way to find the distinct values in an unfiltered fashion?