lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wesley MacDonald" <...@extremesoftware.ca>
Subject RE: how to create a long lasting unique key?
Date Wed, 05 Jan 2005 03:55:16 GMT

Java has GUID's classes called java.rmi.server.UID and
java.rmi.dgc.VMID.

The UID class can generate identifiers that are unique over time within
a JVM. The VMID class provides uniqueness across ALL JVM's.

UID consists of a unique number based on a hashcode, system time and a
counter, and a VMID contains a UID and adds a SHA hash based on IP
address.

Wes. 

-----Original Message-----
From: Luke Shannon [mailto:lshannon@futurebrand.com] 
Sent: Tuesday, January 04, 2005 3:11 PM
To: Lucene Users List
Subject: Re: how to create a long lasting unique key?

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


---------------------------------------------------------------------
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