From java-user-return-53747-apmail-lucene-java-user-archive=lucene.apache.org@lucene.apache.org Fri Sep 21 09:54:47 2012 Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 96AC7DE1A for ; Fri, 21 Sep 2012 09:54:47 +0000 (UTC) Received: (qmail 68529 invoked by uid 500); 21 Sep 2012 09:54:46 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 67723 invoked by uid 500); 21 Sep 2012 09:54:42 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 67502 invoked by uid 99); 21 Sep 2012 09:54:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2012 09:54:40 +0000 X-ASF-Spam-Status: No, hits=3.1 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [106.10.151.64] (HELO nm23-vm1.bullet.mail.sg3.yahoo.com) (106.10.151.64) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 21 Sep 2012 09:54:34 +0000 Received: from [106.10.166.127] by nm23.bullet.mail.sg3.yahoo.com with NNFMP; 21 Sep 2012 09:54:10 -0000 Received: from [119.42.242.53] by tm16.bullet.mail.sg3.yahoo.com with NNFMP; 21 Sep 2012 09:54:09 -0000 Received: from [127.0.0.1] by omp1002.mail.cnh.yahoo.com with NNFMP; 21 Sep 2012 09:54:08 -0000 X-Yahoo-Newman-Id: 751594.14691.bm@omp1002.mail.cnh.yahoo.com Received: (qmail 3135 invoked from network); 21 Sep 2012 09:54:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.cn; s=s1024; t=1348221248; bh=7WcjYoOIGUZX+nX7tp6bXDTQ/vtwP33/8dMyXtzj2Uo=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:User-Agent:Date:Subject:From:To:Message-ID:Thread-Topic:Mime-version:Content-type; b=IwwJCCPk/IIbj5BIYwq1KkQ25unjAxpNc85MMt4PPvCm4pqrBPNg8cPK5qo9EsqreARXqVt2SHJkAz+7ZTrsQ1Sra3RMT5PZvNDajAwG2jO5FRVsPdz/PmBWtl3UxhgEFRkC+GSR0PYwV+HlaU9kzJSwHcKqMq68t70pyLuVaec= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: JjcFagQVM1m3s03IHV4ez5e2IKTXhJ9Ka2lyZPzudTgNf5J rqkebEhS.BPqLiq03Ty5LaDHIWNVJ6iu6HeST_rtXcG6_C4UNBc0oXOuVkNy FmRsTO6PWFBF15fB6VKMZPG26J8bf3e40gRWztFvyMRmFQWKONnu07BoK3vf 0SjvV9YK0SmH9..hJGsxx07.DUbG72r6qax1nzCn_hij6rmjb8786waEJgDg 8UAb7ChhyUPFwnyyrVlr_agnb8lYSE14xpZkClvfkwkWWYl45nwGmdV71SUh wBN8CMj8rmSKpjjJtx90nnN0xr5zFJ5qr.qVdFwJXfj542KiBCji73xuY8yE PhBgPiiTKHIwlZRdreA_Kb65hZjWNi4dtbhb.kO5XXX2yE3gN9FBk.hWtZzK 3EpWJi3Qos6zG9ZK7w77x0mKYk14B4jeG4Q-- X-Yahoo-SMTP: KRfGyzeswBDltxLAjdmu5S1QFSW0cEUENVHjwIAbXF0ppw-- Received: from [192.168.201.230] (wanghuida258@221.133.228.74 with login) by smtp103.mail.cnh.yahoo.com with SMTP; 21 Sep 2012 02:54:08 -0700 PDT User-Agent: Microsoft-MacOutlook/14.10.0.110310 Date: Fri, 21 Sep 2012 17:54:05 +0800 Subject: I want to know that why transform numeric to string From: =?GB2312?B?u9207w==?= =?GB2312?B?IM31?= To: "java-user@lucene.apache.org" Message-ID: Thread-Topic: I want to know that why transform numeric to string Mime-version: 1.0 Content-type: multipart/mixed; boundary="B_3431094847_2016687" X-Virus-Checked: Checked by ClamAV on apache.org --B_3431094847_2016687 Content-type: multipart/alternative; boundary="B_3431094848_2014082" --B_3431094848_2014082 Content-type: text/plain; charset="GB2312" Content-transfer-encoding: quoted-printable hi all: I want to know that why transform numeric to string? public static int longToPrefixCoded(final long val, final int shift, fina= l BytesRef bytes) { if (shift>63 || shift<0) throw new IllegalArgumentException("Illegal shift value, must be 0..63"); int hash, nChars =3D (63-shift)/7 + 1; bytes.offset =3D 0; bytes.length =3D nChars+1; if (bytes.bytes.length < bytes.length) { bytes.grow(NumericUtils.BUF_SIZE_LONG);//11 } bytes.bytes[0] =3D (byte) (hash =3D (SHIFT_START_LONG + shift)); long sortableBits =3D val ^ 0x8000000000000000L; sortableBits >>>=3D shift; while (nChars > 0) { // Store 7 bits per byte for compatibility // with UTF-8 encoding of terms bytes.bytes[nChars--] =3D (byte)(sortableBits & 0x7f); sortableBits >>>=3D 7; } // calculate hash for (int i =3D 1; i < bytes.length; i++) { hash =3D 31*hash + bytes.bytes[i]; } return hash; } =CD=F5=BB=DD=B4=EF (PHP=BF=AA=B7=A2=B9=A4=B3=CC=CA=A6, Sysdev Team) ------------------------- =B7=D6=BB=FA=A3=BA8836 QQ=A3=BA429335915 mobile: 13795449454 E-mail: williamwang@anjuke.com =C9=CF=BA=A3=CA=D0=C6=D6=B6=AB=D0=C2=C7=F8=C2=BD=BC=D2=D7=EC=BB=B7=C2=B7166=BA=C5=CE=B4=C0=B4=D7=CA=B2=FA=B4=F3=CF=C310=C2=A5 --B_3431094848_2014082 Content-type: text/html; charset="GB2312" Content-transfer-encoding: quoted-printable
hi all:
 I want to know that why = transform numeric to string

  public static int longToPrefixCoded(final long val, final int shift,= final BytesRef bytes) {

  &nbs= p; if (shift>63 || shift<0)

      throw new IllegalArgumentExce= ption("Illegal shift value, must be 0..63"  &nbs= p; int hash, nChars =3D (63-shift)/7 + 1;<= /p>

  &nbs= p; bytes.offset =3D 0;

  &nbs= p; bytes.length =3D nChars+1;

  &nbs= p; if (bytes.length < bytes.length) {

  &nbs= p;   bytes.grow(NumericUtils.BUF_SIZE_LONG= );//11

  &nbs= p; }

  &nbs= p; bytes.bytes[0] =3D (byte) (hash =3D (SHIFT_START_LON= G + shift));

  &nbs= p; long sortableBits =3D val ^ 0x800000000= 0000000L;

  &nbs= p; sortableBits >>>=3D shift;

  &nbs= p; while (nChars > 0) {

      // Store 7 bit= s per byte for compatibility

      // with UTF-8 = encoding of terms

  &nbs= p;   bytes.bytes[nChars--] =3D (byte)(sortableBits & 0x7f);

  &nbs= p;   sortableBits >>>=3D 7;

  &nbs= p; }

    // calculate hash

=

  &nbs= p; for (int= i =3D 1; i < bytes.length; i++)= {

  &nbs= p;   hash =3D 31*hash + bytes.bytes[i= ];

  &nbs= p; }

  &nbs= p; return hash;

  }


<= /div>

=CD=F5=BB=DD=B4=EF (PHP=BF=AA=B7=A2=B9=A4=B3=CC=CA=A6, Sysdev Team)
-------------------------
= =B7=D6=BB=FA=A3=BA8836
QQ=A3=BA429335915
mobile: 13795449454
E-mail: william= wang@anjuke.com
=C9=CF=BA=A3=CA=D0=C6=D6=B6=AB=D0=C2=C7=F8=C2=BD=BC=D2=D7=EC=BB=B7=C2=B7166=BA=C5=CE=B4=C0=B4=D7=CA=B2=FA=B4=F3=CF=C310=C2=A5
=
--B_3431094848_2014082-- --B_3431094847_2016687 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --B_3431094847_2016687--