2017-02-23 28 views
0
<entry> 
    <date>1971-12-23</date> 
    <info>Some different information.</info> 
</entry> 

cts:search(doc("/dates.xml")/root/entry, 
    cts:element-range-query(xs:QName("date"), "<=",xs:date("2000-01-01"))) 

如果我有一個字段rpdt,我將如何構造cts:field-word-query來比較日期?我收到了錯誤代碼。cts:字段值查詢來比較日期

cts:field-word-query("rpdt", "<=", xs:date("1952-03-15")) 

回答

3

添加一系列指標在球場上,並使用cts:field-range-query()

https://docs.marklogic.com/cts:field-range-query

+0

我有「edatetime」是一個字段和數據類型是日期/時間。它工作cts:contains(fn:doc(「datetime.xml」),cts:field-range-query(「edatetime」,「=」,「2017-02-24T11:02:31.158-05:00」)) 。但不工作cts:contains(fn:doc(「datetime.xml」),cts:field-range-query(「edatetime」,「=」,「2017-02-24」))。如何構建只有yyyy-mm-dd。謝謝 – thichxai

+1

請問一個單獨的問題,因爲它不是特定於原始問題陳述。 –