You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Paul Taylor <pa...@fastmail.fm> on 2013/02/19 21:56:36 UTC

Field seems to have become binary field on update to Lucene 4.1

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 ?






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


Re: Field seems to have become binary field on update to Lucene 4.1

Posted by Simon Willnauer <si...@gmail.com>.
phew! thanks for clarifying

simon

On Tue, Feb 19, 2013 at 11:19 PM, Paul Taylor <pa...@fastmail.fm> wrote:
> 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
>

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


Re: Field seems to have become binary field on update to Lucene 4.1

Posted by Paul Taylor <pa...@fastmail.fm>.
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