lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Re: Field seems to have become binary field on update to Lucene 4.1
Date Tue, 19 Feb 2013 22:19:25 GMT
On 19/02/2013 20:56, Paul Taylor wrote:
>
> Strange test failure after converting code from Lucene 3.6 to Lucene 4.1
>
> public void testIndexPuid() throws Exception {
>
>         addReleaseOne();
>         RAMDirectory ramDir = new RAMDirectory();
>         createIndex(ramDir);
>
>         IndexReader ir = IndexReader.open(ramDir);
>         Fields fields = MultiFields.getFields(ir);
>         Terms terms = fields.terms("puid");
>         TermsEnum termsEnum = terms.iterator(null);
>         termsEnum.next();
>         assertEquals("efd2ace2-b3b9-305f-8a53-9803595c0e38", 
> termsEnum.term());
>     }
>
> returns:
>
> Expected :efd2ace2-b3b9-305f-8a53-9803595c0e38
> Actual   :[65 66 64 32 61 63 65 32 2d 62 33 62 39 2d 33 30 35 66 2d 38 
> 61 35 33 2d 39 38 30 33 35 39 35 63 30 65 33 38]
>
> It seems to be adding the field as a binary field rather than a text 
> field, but I checked and the field is being added using the deprecated
>
> new Field("puid", value, Field.Index.NOT_ANALYZED_NO_NORMS, new 
> KeywordAnalyzer())
>
> so shouldn't that work the same way as before ?
>
>
>
Doh, my bad missing utf8ToString()


         assertEquals("efd2ace2-b3b9-305f-8a53-9803595c0e38", 
termsEnum.term().utf8ToString());

Paul

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


Mime
View raw message