Skip to main content

Pythonic wrapper for Hyper Estraier

Project description

/static/hypylogo.png

Hypy is a fulltext search interface for Python applications. Use it to index and search your documents from Python code.

Hypy is based on the estraiernative bindings by Yusuke Yoshida.

The estraiernative bindings are, in turn, based on Hyper Estraier by Mikio Hirabayashi.

README

Installation: Ubuntu using APT

Hypy is hosted on Launchpad, and has a launchpad PPA. This is arguably the easiest way to install the software if you are an Ubuntu user.

Add the following lines to the end of /etc/apt/sources.list. You can also paste these lines in to System > Administration > Software Sources > Third-Party Software.

(jaunty)

deb http://ppa.launchpad.net/corydodt/ubuntu jaunty main
deb-src http://ppa.launchpad.net/corydodt/ubuntu jaunty main

(or intrepid)

deb http://ppa.launchpad.net/corydodt/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/corydodt/ppa/ubuntu intrepid main

Then:

sudo apt-get update
sudo apt-get install python-hypy

All dependencies including Hyper Estraier will be auto-fetched for you, and you will get automatic updates when I publish them.

Installation: Non-Ubuntu

If you don’t have Ubuntu or don’t intend to use the PPA, you will need to (a) install Hyper Estraier, then (b) install Hypy.

Don’t be intimidated by how long this section is; check your distribution first for binary packages! Windows users, there’s a link for you below. Everyone who likes things to be complicated, read on.

Installing Hyper Estraier on Windows

If you are using Windows, a binary installer for Windows Hyper Estraier can be had. You must still install Hypy, perhaps with easy_install, so see below.

Installing Hyper Estraier (dev packages) with a package manager

Linux users can probably install binary packages using their favorite package manager. You will need these:

  • hyperestraier runtime

  • libestraier headers and object code

  • libqdbm headers and object code

  • Python headers and object code, natch

If you are using Ubuntu (and for some reason you won’t just use the PPA above), you can get all the build dependencies with this command:

sudo apt-get install hyperestraier libestraier-dev libqdbm-dev python-dev

Installing Hyper Estraier from Source

Instructions for building and installing Hyper Estraier can be found on that site. It is a standard configure/make/make install process, but you must make sure to download all the required files. See the Hyper Estraier installation page for details.

Then: Install Hypy with easy_install

With setuptools (Ubuntu: sudo apt-get install python-setuptools), you can install Hypy without even downloading it first, by using

sudo easy_install hypy

… or: Install Hypy from tarball

Get one of the tarballs linked at the top of the page.

tar xvfz hypy.tar.gz; cd Hypy-*
python setup.py build; sudo python setup.py install

Optionally, run:

make tests

in the source directory to see the unit tests run.

Quick Start

You can get an instant “oh I get it!” fix by looking inside the “examples” directory distributed with this software.

Index documents into a collection (see gather.py for the complete program):

...

db = HDatabase()
db.open('casket', 'w')
# create a document object
doc = HDocument(uri=u'http://estraier.gov/example.txt')
...

Search for documents in an existing collection (see search.py for the complete program):

...

# create a search condition object
cond = HCondition(u'lull*')
# get the result of search
result = db.search(cond)
# iterate the result
for doc in result:
...

Hey, I need Even More Examples

OK.

Here are even more examples. (Find this in the doc/ directory if you unpacked the tarball and are reading this from there.)

Read This! - Unicode

To make the transition to Python 3.0 easier, and because it is a good idea, Hypy requires Unicode objects in all of its APIs.

WRONG

>>> d = HDocument(uri='http://pinatas.com/store.html') # byte string!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-pacakges/hypy/lib.py", line 291, in __init__
    raise TypeError("Must provide uri as unicode text")
TypeError: Must provide uri as unicode text

RIGHT

>>> d = HDocument(uri=u'http://pinatas.com/store.html') # unicode :-)
>>> d.addText(u'Olé')
>>> d[u'@title'] = u'Piñata Store'  # attributes are also unicode

Because of this change, and some other minor, Python-enhancing differences between the APIs, I have deliberately renamed all the classes and methods supported by Hypy, to prevent confusion. If you know Python and are already familiar with Hyper Estraier, you should now visit the API docs to learn the new names of functions. In general, though, “est_someclass_foo_bar” takes a byte string in Hyper Estraier, but becomes “HSomeClass.fooBar” in Hypy and takes Unicode text.

What’s not Supported in Hypy vs. Hyper Estraier

Hyper Estraier implements a version of federated search which is supported by its APIs such as merge, search_meta and eclipse. If I hear a compelling use case or receive patches with unit tests, I may add support for these APIs. This is not a hard thing to do, I just have no use for it myself, so I am reluctant to promise to maintain it unless someone else really needs it.

Contributing and Reporting Bugs

Hypy has a bug tracker on Launchpad.

For more information on contributing, including the URL of the source repository for Hypy, go to DevelopmentCentral on the wiki.

It bears emphasizing that bugs with reproducible steps, patches and unit tests (in that order) get fixed sooner.

License

LGPL 2.1

Hypy (c) Cory Dodt, 2008.

estraiernative (c) Yusuke Yoshida.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Hypy-0.8.5.1.tar.gz (45.1 kB view details)

Uploaded Source

File details

Details for the file Hypy-0.8.5.1.tar.gz.

File metadata

  • Download URL: Hypy-0.8.5.1.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Hypy-0.8.5.1.tar.gz
Algorithm Hash digest
SHA256 56d63dd65b81d1c1c3c57d167833fc3777b99c4d650a5d6b516eef95a27605e0
MD5 61f2a7f618a24dc249d33b4670f13d55
BLAKE2b-256 cccc3cc80c8ff81d12c533f2e32539a9533f6ede5b05c918d215a4c541c0316c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page