lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luke Shannon" <lshan...@futurebrand.com>
Subject Re: how to create a long lasting unique key?
Date Tue, 04 Jan 2005 20:10:50 GMT
This is taken from the example code writen by Doug Cutting that ships with
Lucene.

It is the key our system uses. It also comes in handy when incrementally
updating.

Luke

public static String uid(File f) {
  // Append path and date into a string in such a way that lexicographic
  // sorting gives the same results as a walk of the file hierarchy. Thus
  // null (\u0000) is used both to separate directory components and to
  // separate the path from the date.
  return f.getPath().replace(dirSep, '\u0000') + "\u0000"
    + DateField.timeToString(f.lastModified());
 }

----- Original Message ----- 
From: "Peter Veentjer - Anchor Men" <p.veentjer@anchormen.nl>
To: <lucene-user@jakarta.apache.org>
Sent: Tuesday, January 04, 2005 2:43 PM
Subject: how to create a long lasting unique key?


What is the best way to create a key for a document? I know the id (from
hits) can not be used, but what is a good way to create a key

I need this key for a webapplication. At the moment every document can be
identified with the filelocation key, but I would rather some kind of
integer for the Job (nobody needs to know the file location).


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message