minor improvements
This commit is contained in:
+3
-7
@@ -246,20 +246,16 @@ def info_name(package_name):
|
||||
def search_package_terms(terms, lang = None):
|
||||
if not lang:
|
||||
lang = pisi.pxml.autoxml.LocalText.get_lang()
|
||||
def search(self, id, terms):
|
||||
return pisi.search.query(id, lang, terms)
|
||||
r1 = pisi.search.query_terms('summary', lang, terms)
|
||||
r2 = pisi.search.query_terms('description', lang, terms)
|
||||
r = r1.union(r2)
|
||||
return r
|
||||
|
||||
def search_package(terms, lang = None):
|
||||
def search_package(query, lang = None):
|
||||
if not lang:
|
||||
lang = pisi.pxml.autoxml.LocalText.get_lang()
|
||||
def search(self, id, terms):
|
||||
return pisi.search.query(id, lang, terms)
|
||||
r1 = pisi.search.query('summary', lang, terms)
|
||||
r2 = pisi.search.query('description', lang, terms)
|
||||
r1 = pisi.search.query('summary', lang, query)
|
||||
r2 = pisi.search.query('description', lang, query)
|
||||
r = r1.union(r2)
|
||||
return r
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class Exception(pisi.Exception):
|
||||
# API
|
||||
|
||||
from invertedindex import InvertedIndex
|
||||
from preprocess import preprocess
|
||||
import preprocess as p
|
||||
|
||||
def init(ids, langs):
|
||||
"initialize databases"
|
||||
@@ -48,17 +48,16 @@ def finalize():
|
||||
ctx.invidx = {}
|
||||
|
||||
def add_doc(id, lang, docid, str, txn = None):
|
||||
terms = preprocess(lang, str)
|
||||
terms = p.preprocess(lang, str)
|
||||
ctx.invidx[id][lang].add_doc(docid, terms, txn)
|
||||
|
||||
def remove_doc(id, lang, docid, str, txn = None):
|
||||
ctx.invidx[id][lang].remove_doc(docid, txn)
|
||||
|
||||
def query_terms(id, lang, terms, txn = None):
|
||||
import preprocess as p
|
||||
terms = map(lambda x: p.lower(lang, x), terms)
|
||||
return ctx.invidx[id][lang].query(terms, txn)
|
||||
|
||||
def query(id, lang, str, txn = None):
|
||||
terms = preprocess(lang, str)
|
||||
terms = p.preprocess(lang, str)
|
||||
return query_terms(id, lang, terms, txn)
|
||||
|
||||
Reference in New Issue
Block a user