On Sat, 2007-05-12 at 09:13 -0700, Andi Vajda wrote:
> On Sat, 12 May 2007, Andra Tori wrote:
> 
> > I have problems creating binary fields, i have nailed down the problem
> > to the non-ascii characters in supposed binary data of the field.
> >
> > Here's the testcase:
> > ------------------------------------
> > import PyLucene
> >
> > a = PyLucene.Field("show_tokens", '\xf3',
> >        PyLucene.Field.Store.YES)
> 
> Lucene expect unicode strings. If you pass in a regular byte string as with 
> '\xf3', PyLucene will assume it's a 'utf-8' string when converting it to 
> Unicode for Lucene.
> 
> Given that '\xf3' is not a valid utf-8 string, it fails. If you're going to 
> use non utf-8 strings with PyLucene, you need to convert them to unicode 
> first 
> yourself with u'\xf3' or unicode('\xe9', 'iso-8859-1'), for example.

according to 
http://lucene.apache.org/java/2_0_0/api/index.html

there is a constructor:
Field(String name, byte[] value, Field.Store store) 
          Create a stored field with binary value.

... which is what i want since it specifies byte array as second
argument and because this is the only constructor that accepts
Field.Store as third parameter and no fourth.

I am actually storing binary stuff in here, not unicode... How can i
trigger that constructor?

bye
andraz

_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to