[Xapian-discuss] Seek help with simple writer/search using Perl

Mark Blythe list at markblythe.com
Mon Apr 9 21:53:15 BST 2007


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:

url|title|description

Then you could retrieve it and fill a hash by doing a simple split:

my %data;
@data{qw(url title description)} = split(/\|/, $document->get_data);

On 4/9/07, Jeff Anderson <captvanhalen at gmail.com> wrote:
>
> Actually ... if there is some piece of documentation out there that
> exlains why one should use data,  postings, or terms ... that would be
> great guys. I'm not looking for someone to do my work for me, i have
> just found the documents for this tool to be very lacking and am
> simply seeking some direction.
>
> We can always continue to use Plucene, i suppose ...
>
> On 4/9/07, Jeff Anderson <captvanhalen at gmail.com> wrote:
> > Thanks for the answers Olly (and Ralf).
> >
> > Of course, now i have more questions. :)
> >
> >
> >
> > On 4/9/07, Olly Betts <olly at survex.com> wrote:
> > > The document data is opaque as far as Xapian is concerned.  Store
> > > whatever you want there (typically you'd put things you need to
> display
> > > a match to the user, like the title, a sample of text, etc).
> >
> > Great. In Lucene i was able to do this like so:
> >
> > Plucene::Document::Field->Text($key => $value)
> >
> > The key point is here is that i could add multiple key/value pairs,
> > and be able to retrieve them when it came time to display results to
> > the user. I would store the Title, URL, and a text blurb in this
> > manner.
> >
> > However ... can i store key/values in
> Search::Xapian::Document::set_data() ??
> >
> > According to the docs, it only takes a single argument called "data" :
> >
> > "set_data <data>
> >     Set all document data. This can be anything you like."
> >
> > How can i store fields such as URL AND title AND description so that i
> > can retrieve them from the objects returned in a successful match?
> >
> > Thanks again,
> > --
> > jeffa
> >
>
>
> --
> jeffa
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>


More information about the Xapian-discuss mailing list