Jeff Anderson
2007-Apr-09 22:22 UTC
[Xapian-discuss] Re: Xapian-discuss Digest, Vol 35, Issue 9
On 4/9/07, xapian-discuss-request@lists.xapian.org <xapian-discuss-request@lists.xapian.org> wrote:> Message: 6 > Date: Mon, 9 Apr 2007 13:53:15 -0700 > From: "Mark Blythe" <list@markblythe.com> > Since Xapian doesn't have any expectations about the data you store in the > document, you can store whatever you like. It could be a serialized data > structure (using Data::Dumper, JSON, etc), or something more simple like a > delimited string. In your case, you might store something like:Oh dear ... for real? Hmmm. Well, if that's the only way ... still, i'd rather not have to write a parser to get back display results. Since any character could be allowed in the description, it's an unsafe assumption to say a delitimited string would work 100% of the time. And using eval to reconstruct a Data::Dumper dumped hash ref can be dangerous. XML? Great. :| Thanks for help ... -- jeffa
Mark Blythe
2007-Apr-09 22:37 UTC
[Xapian-discuss] Re: Xapian-discuss Digest, Vol 35, Issue 9
I wouldn't go so far as to write a full parser either, but there are plenty of pre-existing packages for serializing/deserializing data structures. You shouldn't have to re-invent the wheel. If you want to go with a delimited string and can't think of any printable character that you can guarantee won't be in the data, you can always choose a non-printable delimiter, like a chr(0) or chr(7). If you want to store key/value pairs but don't trust eval Data::Dumper, use JSON. It's eval-safe and language-independent. By not enforcing a key/value data setup, Xapian stays completely flexible and can support storing any kind of data, including BLOBs, etc. I personally think it was a smart choice for a generic library. On 4/9/07, Jeff Anderson <captvanhalen@gmail.com> wrote:> > On 4/9/07, xapian-discuss-request@lists.xapian.org > <xapian-discuss-request@lists.xapian.org> wrote: > > Message: 6 > > Date: Mon, 9 Apr 2007 13:53:15 -0700 > > From: "Mark Blythe" <list@markblythe.com> > > Since Xapian doesn't have any expectations about the data you store in > the > > document, you can store whatever you like. It could be a serialized > data > > structure (using Data::Dumper, JSON, etc), or something more simple like > a > > delimited string. In your case, you might store something like: > > Oh dear ... for real? Hmmm. Well, if that's the only way ... still, > i'd rather not have to write a parser to get back display results. > Since any character could be allowed in the description, it's an > unsafe assumption to say a delitimited string would work 100% of the > time. And using eval to reconstruct a Data::Dumper dumped hash ref can > be dangerous. XML? Great. :| > > Thanks for help ... > > -- > jeffa > > _______________________________________________ > Xapian-discuss mailing list > Xapian-discuss@lists.xapian.org > http://lists.xapian.org/mailman/listinfo/xapian-discuss >