Skip to content

Instantly share code, notes, and snippets.

@pkafei
Created February 7, 2013 20:34
Show Gist options
  • Save pkafei/4733933 to your computer and use it in GitHub Desktop.
Save pkafei/4733933 to your computer and use it in GitHub Desktop.
tranlsation
Zapian, Xapian documentation
1. Python Programmer, loves Xapian but Xappy is old and has been having some problems. He likes elastic search api but hates Java's Lucene architecture.
2. Maybe this will help you, and you can visit him @ http://weibo.com/panjunyong
Properties:
1.Xapian provides a friendly schemaless api
2.Support search index
-Change path to database
db = Zapian(path='/tmp/test_zapian_db')
-Add an index
db.add_part('2001-02')
-Modify the index
db.add_document(part='2001-02',
uid='1111',
index = { '+title' : u'我们很好.doc',
'searchable_text' : u'',
'modified' : datetime.datetime(),
'crated' : datetime.datetime()
},
data = {}
)
-Replace the index
db.replace_document(part, uid, doc)
-Delete the index
db.delete_document(pat, uid)
-Search
db.search(parts, ["and",
{ "filters":
"exclude":
},
[ "or",
{"filters":
"exclude": },
{ "filters":
"exclude": }
]
]
)
Doc and Index Relationship
Xapian has three applications: indexes terms, puts data fields in order,
and returns data.
-set/list/tuple: Each includes pair term data
-string/unicode: Uses whole search terms
-data/int/float: Sorts the range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment