Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 74151 invoked from network); 5 Jan 2005 03:55:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Jan 2005 03:55:48 -0000 Received: (qmail 89391 invoked by uid 500); 5 Jan 2005 03:55:41 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 89369 invoked by uid 500); 5 Jan 2005 03:55:40 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 89355 invoked by uid 99); 5 Jan 2005 03:55:40 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from hs-216-106-102-23.storm.ca (HELO extremesoftware.ca) (216.106.102.23) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 04 Jan 2005 19:55:37 -0800 Subject: RE: how to create a long lasting unique key? MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Tue, 4 Jan 2005 22:55:16 -0500 Message-ID: <41989D7DF8323B4CB0F7A58F5BA01019039E15@sydney.extremesoftware.ca> X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: how to create a long lasting unique key? Thread-Index: AcTymToTsbXwnTZ5T/2kk8fXCaHGIQAQMGOw From: "Wesley MacDonald" To: "Lucene Users List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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.=20 -----Original Message----- From: Luke Shannon [mailto:lshannon@futurebrand.com]=20 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" To: 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