lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wang <john.w...@gmail.com>
Subject lucene 2.9+ numeric indexing
Date Sun, 08 Nov 2009 08:36:07 GMT
Hi guys:

    Running into a strange problem:

    I am indexing into a field a numeric string:

    int n = Math.abs(rand.nextInt(1000000));

  Field myField = new Field(MY_FIELD,String.valueOf(n),Store.NO,Index.
NOT_ANALYZED_NO_NORMS);

  myField.setOmitTermFreqAndPositions(true);

  doc.add(myField);



  I am trying to load this field into a FieldCache, e.g. :


int[] data = FieldCache.DEFAULT.getInts(reader, MY_FIELD);


  and I get: Exception in thread "main" java.lang.NumberFormatException:
Invalid shift value in prefixCoded string (is encoded value really an INT?)

  After further examination, I see the original Integer.parseInt failed
because the termText was:

java.lang.NumberFormatException: For input string: "77886$"


  I am not clear why the term text became: 77886$ instead of a number.


  I examined the index using Luke and at least according to Luke, the number
displayed was 77886:


    i.e. searching for: MY_FIELD:77886$ does yield a doc, and using
reconstructing the doc functionality, I see the value is  77886.


Ideas?


Thanks


-John

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message