<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flax Blog &#187; python</title>
	<atom:link href="http://www.flax.co.uk/blog/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flax.co.uk/blog</link>
	<description>Open source &#38; enterprise search</description>
	<lastBuildDate>Wed, 25 Jan 2012 14:56:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Open source search engines and programming languages</title>
		<link>http://www.flax.co.uk/blog/2010/09/03/open-source-search-engines-and-programming-languages/</link>
		<comments>http://www.flax.co.uk/blog/2010/09/03/open-source-search-engines-and-programming-languages/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 10:40:16 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[flax]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[lucene]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SOLR]]></category>
		<category><![CDATA[xapian]]></category>

		<guid isPermaLink="false">http://www.flax.co.uk/blog/?p=352</guid>
		<description><![CDATA[<p>So you&#8217;re writing a search-related application in your favourite language, and you&#8217;ve decided to choose an open source search engine to power it. So far, so good &#8211; but how are the two going to communicate?</p>
<p>Let&#8217;s look at two&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;re writing a search-related application in your favourite language, and you&#8217;ve decided to choose an open source search engine to power it. So far, so good &#8211; but how are the two going to communicate?</p>
<p>Let&#8217;s look at two engines, <a href="http://www.xapian.org">Xapian</a> and <a href="http://www.lucene.net">Lucene</a>, and compare how this might be done. Lucene is written in Java, Xapian in C/C++ &#8211; so if you&#8217;re using those languages respectively, everything should be relatively simple &#8211; just download the source code and get on with it. However if this isn&#8217;t the case, you&#8217;re going to have to work out how to interface to the engine. </p>
<p>The Lucene project has been rewritten in several other languages: for C/C++ there&#8217;s <a href="http://incubator.apache.org/lucy/">Lucy</a> (which includes Perl and Ruby bindings), for Python there&#8217;s <a href=http://lucene.apache.org/pylucene/>PyLucene</a>, and there&#8217;s even a .Net version called, not surprisingly, <a href="http://incubator.apache.org/lucene.net/">Lucene.NET</a>. Some of these &#8216;ports&#8217; of Lucene are &#8216;looser&#8217; than others (i.e. they may not share the same API or feature set), and they may not be updated as often as Lucene itself. There are also versions in Perl, Ruby, Delphi or even Lisp (scary!) &#8211; there&#8217;s a <a href="http://wiki.apache.org/lucene-java/LuceneImplementations">full list</a> available. Not all are currently active projects.</p>
<p>Xapian takes a different approach, with only one core project, but a sheaf of bindings to other languages. Currently these bindings cover C#, Java, Perl, PHP, Python, Ruby and Tcl &#8211; but interestingly these are <em>auto-generated</em> using the <a href="http://www.swig.org/">Simplified Wrapper and Interface Generator</a> or SWIG. This means that every time Xapian&#8217;s API changes, the bindings can easily be updated to reflect this (it&#8217;s actually not quite that simple, but SWIG copes with the vast majority of code that would otherwise have to be manually edited). SWIG actually supports other languages as well (according to the SWIG website, &#8220;Common Lisp (CLISP, Allegro CL, CFFI, UFFI), Lua, Modula-3, OCAML, Octave and R. Also several interpreted and compiled Scheme implementations (Guile, MzScheme, Chicken)&#8221;) so in theory bindings to these could also be built relatively easily.</p>
<p>There&#8217;s also another way to communicate with both engines, using a <em>search server</em>. <a href="http://lucene.apache.org/solr/">SOLR</a> is the search server for Lucene, whereas for Xapian there is <a href="http://www.flax.co.uk/the_software">Flax Search Service</a>. In this case, any language that supports Web Services (you&#8217;d be hard pressed to find a modern language that doesn&#8217;t) can communicate with the engine, simply passing data over the HTTP protocol. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flax.co.uk/blog/2010/09/03/open-source-search-engines-and-programming-languages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>flax.crawler arrives</title>
		<link>http://www.flax.co.uk/blog/2010/08/02/flax-crawler-arrives/</link>
		<comments>http://www.flax.co.uk/blog/2010/08/02/flax-crawler-arrives/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 15:22:24 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[crawling]]></category>
		<category><![CDATA[flax]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.flax.co.uk/blog/?p=329</guid>
		<description><![CDATA[<p>We&#8217;ve recently uploaded a new <a href="http://code.google.com/p/flaxcode/source/browse/trunk/flax/crawler/">crawler framework</a> to the Flax code repository. This is designed for use from Python to build a <a href="http://en.wikipedia.org/wiki/Web_crawler">web crawler</a> for your project. It&#8217;s multithreaded and simple to use, here&#8217;s a minimal example:&#8230;</p>
<p]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve recently uploaded a new <a href="http://code.google.com/p/flaxcode/source/browse/trunk/flax/crawler/">crawler framework</a> to the Flax code repository. This is designed for use from Python to build a <a href="http://en.wikipedia.org/wiki/Web_crawler">web crawler</a> for your project. It&#8217;s multithreaded and simple to use, here&#8217;s a minimal example:</p>
<p style="padding-left: 30px;"><code> import crawler</code></p>
<p style="padding-left: 30px;"><code> crawler.dump = MyContentDumperImplementation()</code><br />
<code> crawler.pool.add_url(StdURL("http://test/"))</code><br />
<code> crawler.pool.add_url(StdURL("http://anothertest/"))</code><br />
<code> crawler.start()</code></p>
<p>Note that you can provide your own implementation of various parts of the crawler &#8211; and you must at least provide a &#8216;content dumper&#8217; to store whatever the crawler finds and downloads.</p>
<p>We&#8217;ve also included a reference implementation, a working crawler that stores URLs and downloaded content in a SQLite3 database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flax.co.uk/blog/2010/08/02/flax-crawler-arrives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flax.core 0.1 available</title>
		<link>http://www.flax.co.uk/blog/2010/06/24/flax-core-0-1-available/</link>
		<comments>http://www.flax.co.uk/blog/2010/06/24/flax-core-0-1-available/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 15:50:53 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[flax]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xapian]]></category>

		<guid isPermaLink="false">http://www.flax.co.uk/blog/?p=296</guid>
		<description><![CDATA[<p>Charlie <a href="http://www.flax.co.uk/blog/2010/06/14/packaged-solutions-and-customisability-the-python-way/">wrote previously</a> that we try and work with flexible, lightweight frameworks:  <strong>flax.core</strong> is a Python library for conveniently adding functionality to Xapian projects. The current (and first!) version is 0.1, which can be checked out from the <a&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Charlie <a href="http://www.flax.co.uk/blog/2010/06/14/packaged-solutions-and-customisability-the-python-way/">wrote previously</a> that we try and work with flexible, lightweight frameworks:  <strong>flax.core</strong> is a Python library for conveniently adding functionality to Xapian projects. The current (and first!) version is 0.1, which can be checked out from the <a href="http://code.google.com/p/flaxcode/source/checkout">flaxcode repository</a>. This version supports named fields for indexing and search (no need to deal with prefixes or value numbers), facets, simplified query construction, and an optional action-oriented indexing framework.</p>
<p>Unlike <a href="http://xappy.org/">Xappy</a>, flax.core makes no attempt to abstract or hide the Xapian API, and is therefore aimed at a rather different audience. The reason is our observation that &#8220;interesting&#8221; search applications often require customisation at the Xapian API level, for example bespoke MatchDeciders, PostingSources or Sorters. Rather than having to dive in and modify the flax.core code, these application-specific modifications can happily co-exist with the unmodified flax.core (at least, this is the intention). It is also intended that flax.core remains minimal enough to easily port to other languages such as PHP or Java.</p>
<p>The primary flax.core class is <strong>Fieldmap</strong>, which associates a set of named fields with a Xapian database. As an example, the following code sets up a simple structure of one &#8216;freetext&#8217; and one &#8216;filter&#8217; field:</p>
<pre>    import xapian
    import flax.core

    db = xapian.WritableDatabase('db', xapian.DB_CREATE)
    fm = flax.core.Fieldmap()
    fm.language = 'en'              # stem for English
    fm.setfield('mytext', False)      # freetext field
    fm.setfield('mydate', True)       # filter field

    fm.save(db)</pre>
<p>and this code indexes some text and a datetime:</p>
<pre>    doc = fm.document()
    doc.index('mytext', "I don't like spam.")
    doc.index('mydate', datetime(2010, 2, 3, 12, 0))
    fm.add_document(db, doc)
    db.flush()</pre>
<p>Fields can be of type string, int, float or datetime. These are handled automatically, and are not tied to fieldnames (so it would be possible to have field instances of different types, not that this is a good idea).</p>
<p>Indexing can also be performed by the Action framework. In this case, a text file contains a list of:</p>
<ul>
<li>external identifiers (such as XPaths,  SQL column name etc)</li>
<li>flax fieldname</li>
<li>indexing actions</li>
</ul>
<p>For example, an actions file for XML might look like this:</p>
<pre>
    .//metadata[@name='Author']/@value
        author: filter(facet)
        author2: index(default)

    .//metadata[@name='Year']/@value
        published: numeric
</pre>
<p>This means that &#8216;Author&#8217; metadata elements are indexed as two flax fields: &#8216;author&#8217; is a filter field which stores facet values, while &#8216;author2&#8242; is a freetext field which is searchable by default. &#8216;Year&#8217; metadata elements are indexed as the flax field &#8216;published&#8217;, which is numeric.</p>
<p>The flaxcode repository contains two example flax.core applications here:</p>
<pre>
    applications/flax_core_examples
</pre>
<p>One is an XML indexer implemented in less than 100 lines, the other is a minimal web search application in a similar number of lines. Currently there is no documentation other than these examples and the docstrings in flax.core. If anyone needs some, I&#8217;ll put some together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flax.co.uk/blog/2010/06/24/flax-core-0-1-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Packaged solutions and customisability, the Python way</title>
		<link>http://www.flax.co.uk/blog/2010/06/14/packaged-solutions-and-customisability-the-python-way/</link>
		<comments>http://www.flax.co.uk/blog/2010/06/14/packaged-solutions-and-customisability-the-python-way/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 11:14:43 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[flax]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xapian]]></category>

		<guid isPermaLink="false">http://www.flax.co.uk/blog/?p=293</guid>
		<description><![CDATA[<p>With any large scale software installation, there is going to be some customisation and tweaking necessary, and enterprise search systems are no exception. Whatever features are packaged with a system, some of those you need will be missing and some&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>With any large scale software installation, there is going to be some customisation and tweaking necessary, and enterprise search systems are no exception. Whatever features are packaged with a system, some of those you need will be missing and some won&#8217;t be used at all. It&#8217;s rare to see a situation where the search engine can just be installed straight out of the box.</p>
<p>Our Flax system is based on the <a href="http://www.xapian.org">Xapian</a> core, which has a set of bindings to various different languages including Perl, Python, PHP, Java, Ruby, C# and even TCL, which makes integration with systems where a particular language is preferred relatively easy. However for the Flax layer itself (comprising file filters, indexers, crawlers, front ends, administration tools etc. &#8211; the &#8216;toolkit&#8217; for building a complete search system) we chose Python, for much the same reasons as the <a href="http://www.python.org/about/success/verity/">Ultraseek developers did back in 2003</a>.</p>
<p>The flexibility of Python means we can add any missing features very fast, and create complete new systems in a matter of days &#8211; for example, often a complete indexer can be created in less than 50 lines of code, by re-using existing components and taking advantage of the many Python modules available (such as XML parsers). Our open source approach also means that solutions we create for one customer can often be repurposed and adapted for another &#8211; which again makes for very short development cycles. Python is also available on a wide variety of platforms.</p>
<p>We&#8217;re <a href="http://xkcd.com/353/">not alone</a> in our preference for Python of course!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flax.co.uk/blog/2010/06/14/packaged-solutions-and-customisability-the-python-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python and Flax presentation</title>
		<link>http://www.flax.co.uk/blog/2009/06/25/python-and-flax-presentation/</link>
		<comments>http://www.flax.co.uk/blog/2009/06/25/python-and-flax-presentation/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 09:49:25 +0000</pubDate>
		<dc:creator>charlie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[flax]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xapian]]></category>
		<category><![CDATA[xappy]]></category>

		<guid isPermaLink="false">http://www.flax.co.uk/blog/?p=154</guid>
		<description><![CDATA[<p>My colleague Richard Boulton will be presenting at <a href="http://www.europython.eu/">Europython</a> in Birmingham, U.K. next week, specifically at 15.30 on Tuesday 30th June &#8211; an <a href="http://www.europython.eu/talks/talk_abstracts/index.html#talk55">abstract</a> is available. He&#8217;ll be talking about Xapian, Xappy and Flax, and showing examples of&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>My colleague Richard Boulton will be presenting at <a href="http://www.europython.eu/">Europython</a> in Birmingham, U.K. next week, specifically at 15.30 on Tuesday 30th June &#8211; an <a href="http://www.europython.eu/talks/talk_abstracts/index.html#talk55">abstract</a> is available. He&#8217;ll be talking about Xapian, Xappy and Flax, and showing examples of these in action including one using a <a href="http://www.djangoproject.com/">Django</a> integration layer. </p>
<p><strong>Update</strong>: you can now <a href="http://flaxcode.googlecode.com/svn/trunk/flax_search_service/docs/presentations/europython2009.odp">download</a> the slides for Richard&#8217;s talk in OpenOffice format.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flax.co.uk/blog/2009/06/25/python-and-flax-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

