MarkLogic 9.0.8
On UI, apart from search text, few filters are applied including publish date year. As we can't control how end user will write query in multiline textbox.
So at end query look like something
- AU:Manish AND PY:>=2001 AND CT:Control AND UT:uncontrol AND PY:<=2010
- (AU:Manish AND PY:>=2001) OR (CT:Control AND UT:uncontrol AND PY:<=2010)
- AU:Manish AND CT:Control AND UT:uncontrol AND PY:>=2001 AND PY:<=2010
Till now we managed with having year range at the end in query and was working with following code
Qyery: AU:Manish AND CT:Control AND UT:uncontrol OR PY:>=2001 AND PY:<=2010
<additional-query>
{
cts:and-query((
cts:path-range-query("contg/sortdate/yr", ">=",xs:int($startYear)),
cts:path-range-query("contg/sortdate/yr", "<=",xs:int($endYear))))
}
</additional-query>
But now as user can put year range anywhere in the query text, its not working as expected
So can we write condition in constraint directly and how to put additional query inside ?
<constraint name="Year">
<range type="xs:int" facet="false">
<path-index>article/date/year</path-index>
</range>
</constraint>
Expected Behavior
If user pass year range then it should return documents within given range if not then it will not apply year range