Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

Interfaces to xapian

on

  • 1,225 views

 

Statistics

Views

Total Views
1,225
Views on SlideShare
1,225
Embed Views
0

Actions

Likes
1
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Interfaces to xapian Presentation Transcript

  • 1. Interfaces to Xapian Open source search day 2009
  • 2. C++ #include <xapian.h> Xapian::WritableDatabase db(path, Xapian::DB_OPEN); Xapian::Document doc; doc.add_term(“foo”); db.add_document(doc);
  • 3. Python: xapian import xapian db = xapian.WritableDatabase(path, xapian.DB_OPEN) doc = xapian.Document() doc.add_term(“foo”) db.add_document(doc)
  • 4. Python: xappy from xappy import IndexerConnection, FieldActions db = xappy.IndexerConnection(path) db.add_field_action(“text”, FieldActions.INDEX_FREETEXT) doc = xappy.UnprocessedDocument() doc.append(“text”, “foo”) db.add(doc)
  • 5. Python: xappy from xappy import IndexerConnection, FieldActions db = xappy.IndexerConnection(path) db.add_field_action(“text”, FieldActions.INDEX_FREETEXT, language=”french” ) doc = xappy.UnprocessedDocument() doc.append(“text”, “foo”) db.add(doc)
  • 6. from xappy 2.core import * db = xappy.IndexerConnection(path) db.add_field _type (“text”, TEXT , language=”french”) db.add_index(“text”, StandardAnalyser) doc = xappy.UnprocessedDocument() doc.append(“text”, “foo”) db.add(doc) Python: xappy2.core
  • 7. Python: xappy2.server REST based API
  • 8. Python: xappy2.server PUT to /v1/dbs/ dbname POST to /v1/dbs/ dbname /schema/fields/text { 'type': 'text', 'freetext': {'language': 'en'} } } POST to /v1/dbs/ dbname /docs { 'text': ['foo'] } (or PUT to /v1/dbs/ dbname /docs/ docid)
  • 9. Python: Zope: ore.xapian Zope style layer on top of xappy: class Content( object ): ... implements( interfaces.IIndexable ) Asynchronous loading/updating, event integration, etc
  • 10. Python: Django: Djapian Django integration layer on top of xapian import djapian class EntryIndexer(djapian.Indexer): fields=[&quot;text&quot;] Tags=[ (&quot;content&quot;, &quot;content.text&quot; ) ]
  • 11. Python: Django: Haystack Another Django integration layer on top of xapian from haystack import indexes class TextIndex(indexes.SearchIndex): text = indexes.CharField(document=True, use_template=True)
  • 12. Other Similar stack of interfaces for Ruby, PHP Java, C# just have bindings, so far
  • 13. Image Searching with Xappy db.add_field_action('image', FieldActions.IMGSEEK, terms = True) doc.fields.append('image', path_to_image_file) db.add(doc) query = sconn.query_image_similarity('image', docid='0')