On Aug 29, 2006, at 3:54 PM, Mag Gam wrote:
"Index the date". Do you mean, index date, or the document date?
Could this be in a LIA book?
This is entirely up to you. What gets indexed is entirely within the
developers control. What date do you want indexed? I presume by
"document date" you mean a file system document. But I'm thinking
more generally here - "documents" in Lucene can be pulled from thin
air, not just from file system documents. You are welcome to use the
file system date.
LIA does have an example of this, which actually makes some tests
fail if the data file dates are changed.
TestDataDocumentHandler.java indexes .properties files via the Ant
<index> task (in contrib/ant in Subversion), and that task indexes
the file last modified timestamp automatically with each document.
SortingExample.java has examples of sorting (though not by this
datestamp, but same idea).
Erik
On 8/29/06, Erik Hatcher <[EMAIL PROTECTED]> wrote:
On Aug 29, 2006, at 11:50 AM, Mag Gam wrote:
> Is it possible to sort results by date of the document?
Sure, check out the Sort class and the overloaded
IndexSearcher.search
() methods that take a Sort. You will need to index the date in a
sortable way. DateTools provides handy methods for this purpose.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]