[Xapian-discuss] Xapian-discuss Digest, Vol 88, Issue 9

Sam Millman sam.millman at gmail.com
Wed Sep 21 12:24:53 BST 2011


Thanks that helped :).

I am still trying to cover add_value some more though since I seem to not
understand it totally.

I guess it is because I am used to Lucene and Sphinx and Solr and it appears
that Xapian seems to attach the type of value stored more on add_value. Like
for example I am still a bit confused on how slotno actually works and what
it actually is.

I think the main thing is showing, in php (or C++ in the official docs), how
to index a complex document of say:

{
   "_id": string
   "text": string
    "tags": multivalue
    "date_created": timestamp
}

And sorting it via the different ways and showing exactly how to define that
date_created is a timestamp and sort on that time stamp and also showing how
to query tags field.

This would really break the ice for anyone wanting to learn Xapian in PHP.
Especially if they are used to other search techs and are finding it hard to
get their mind to see another way of doing it.

Using the API doc directly did help quite a bit but at times I was finding
myself trying to reference, say, add_value to a more indepth topic about
itself and failing.

Faceting section is great that shows examples and everything and quite a few
other sections are good but I am kinda stuck when it comes to actually
indexing and defining types

Like in the official documentation it would be awesome if indexing and
adding documents sections would give you examples on indexing in the native
C++ and explaining how the different indexing method works and what
add_value is and how it all kinda binds together with slotno and that and
just in general how Xapian indexing, add of documents, add of values, the
actual methods and all that works.

I see a lot of documentation based around the methods but none on the
methods themselves.

If I am being blind with the docs do correct me :)

Thanks,

On 21 September 2011 12:00, <xapian-discuss-request at lists.xapian.org> wrote:

> Send Xapian-discuss mailing list submissions to
>        xapian-discuss at lists.xapian.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.xapian.org/mailman/listinfo/xapian-discuss
> or, via email, send a message with subject or body 'help' to
>        xapian-discuss-request at lists.xapian.org
>
> You can reach the person managing the list at
>        xapian-discuss-owner at lists.xapian.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Xapian-discuss digest..."
>
>
> Today's Topics:
>
>   1. Understanding API Documentation for PHP (Sam Millman)
>   2. Re: Understanding API Documentation for PHP (Peter Van Dijk)
>   3. Re: Understanding API Documentation for PHP (James Aylett)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 20 Sep 2011 15:53:20 +0100
> From: Sam Millman <sam.millman at gmail.com>
> Subject: [Xapian-discuss] Understanding API Documentation for PHP
> To: xapian-discuss at lists.xapian.org
> Message-ID:
>        <CALKyTE4sGEQOHK+b52rHEGiEewO6_WfNR_r-H5XnO4a+uEXRuA at mail.gmail.com
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hey everyone,
>
> I am brand new to Xapian so forgive me if I am just being noob.
>
> I looked over the sparse documentation for the Xapian library and its PHP
> hooks and I am really confused how to complete my index.
>
> I understand how to add documents etc etc etc and how to build queries but
> how I do specify in add_value what field type xapian should take (i.e.
> tokenized, unindexed, indexed)?
>
> Is there a list of slotno's anywhere that I can reference to?
>
> In a general sense is there any more programmer orientated
> documentation/tutorials rather than researcher orientated document than
> http://xapian.org/docs/ that better describes the steps of indexing and
> searching etc?
>
> Thanks in advance,
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 21 Sep 2011 09:23:36 +1000
> From: Peter Van Dijk <pvandijk at vision6.com.au>
> Subject: Re: [Xapian-discuss] Understanding API Documentation for PHP
> To: xapian-discuss <Xapian-discuss at lists.xapian.org>
> Message-ID:
>        <CALyzhQHfX=x8nFL=QhM01S0V4XD56VmKh1mOBRespyn87yObDg at mail.gmail.com
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> On 21 September 2011 00:53, Sam Millman <sam.millman at gmail.com> wrote:
>
> > I understand how to add documents etc etc etc and how to build queries
> but
> > how I do specify in add_value what field type xapian should take (i.e.
> > tokenized, unindexed, indexed)?
> >
>
> I'm not sure if i'm interpreting what you're saying correctly, but if you
> want to tokenize or index things, you want to look towards
> XapianTermGenerator::index_text instead.
>
> Values are stored against the documents and aren't directly part of the
> indexed text, so just set your class up with some basic constants, const
> VALUE_X = 0; const VALUE_Y = 1;
> and then pass them to add_value and get_value as required, ie.
> $document->add_value(self::VALUE_X, $anything);  or
> $document->get_value(VALUE_X);
>
> In a general sense is there any more programmer orientated
> > documentation/tutorials rather than researcher orientated document than
> > http://xapian.org/docs/ that better describes the steps of indexing and
> > searching etc?
>
>
> The docs arent really researcher oriented; the overview page is a good
> place
> to start, as it describes how the api is used:
> http://xapian.org/docs/overview.html
>
> That being said, having recently worked on a PHP based deployment of Xapian
> i can tell you i struggled somewhat with the same thing.
> The PHP wrapper really doesn't clue you in as to what types you should be
> passing to any given method, so you'll find yourself having to wrap a lot
> of
> stuff with intval( ) or strval( ) for the methods to work correctly,
> which is a side effect of trying to use a wrapper designed for a strongly
> typed language with a loosely typed one.
>
> That being said, the api docs are spot on for the most part, i'd recommend
> cracking open xapian.php and reading it in line with
> http://xapian.org/docs/apidoc/html/annotated.html,
> given any object in the api docs just look up it's declaration in
> xapian.php
> and you should be able to figure out how to use it correctly, as all the
> types are correctly listed in the documentation.
>
> I'm not going to have a chance for a while, but if i get the opportunity
> i'd
> like to write some docs for using Xapian in PHP for the wiki.
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 21 Sep 2011 08:51:28 +0100
> From: James Aylett <james-xapian at tartarus.org>
> Subject: Re: [Xapian-discuss] Understanding API Documentation for PHP
> To: Peter Van Dijk <pvandijk at vision6.com.au>
> Cc: xapian-discuss <Xapian-discuss at lists.xapian.org>
> Message-ID: <7F621A53-78C6-4F93-A3F9-3A9F5C5A9408 at tartarus.org>
> Content-Type: text/plain; charset=us-ascii
>
> On 21 Sep 2011, at 00:23, Peter Van Dijk wrote:
>
> > That being said, having recently worked on a PHP based deployment of
> Xapian
> > i can tell you i struggled somewhat with the same thing.
> > The PHP wrapper really doesn't clue you in as to what types you should be
> > passing to any given method, so you'll find yourself having to wrap a lot
> of
> > stuff with intval( ) or strval( ) for the methods to work correctly,
> > which is a side effect of trying to use a wrapper designed for a strongly
> > typed language with a loosely typed one.
>
> I think this is because of a lack of attention to the PHP bindings, sadly;
> the aim is for idiomatic code in the bindings language to work, and we do
> well in say Python but less well in others.
>
> If there are specific things that would help here, it'd be great to get
> them either onto a page on the wiki talking about how the PHP bindings could
> be improved, or into tickets. Beyond <http://trac.xapian.org/ticket/520> I
> couldn't find anything at the moment.
>
> Best,
> James
>
> --
>  James Aylett
>  talktorex.co.uk - xapian.org - devfort.com - spacelog.org
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>
>
> End of Xapian-discuss Digest, Vol 88, Issue 9
> *********************************************
>


More information about the Xapian-discuss mailing list