"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "roundup/backends/indexer_common.py" between
roundup-1.6.1.tar.gz and roundup-2.0.0.tar.gz

About: Roundup is an highly customisable issue-tracking system with command-line, web and e-mail interfaces (written in Python).

indexer_common.py  (roundup-1.6.1):indexer_common.py  (roundup-2.0.0)
skipping to change at line 43 skipping to change at line 43
def search(self, search_terms, klass, ignore={}): def search(self, search_terms, klass, ignore={}):
"""Display search results looking for [search, terms] associated """Display search results looking for [search, terms] associated
with the hyperdb Class "klass". Ignore hits on {class: property}. with the hyperdb Class "klass". Ignore hits on {class: property}.
""" """
# do the index lookup # do the index lookup
hits = self.getHits(search_terms, klass) hits = self.getHits(search_terms, klass)
if not hits: if not hits:
return {} return {}
designator_propname = {} designator_propname = {}
for nm, propclass in klass.getprops().iteritems(): for nm, propclass in klass.getprops().items():
if _isLink(propclass): if _isLink(propclass):
designator_propname.setdefault(propclass.classname, designator_propname.setdefault(propclass.classname,
[]).append(nm) []).append(nm)
# build a dictionary of nodes and their associated messages # build a dictionary of nodes and their associated messages
# and files # and files
nodeids = {} # this is the answer nodeids = {} # this is the answer
propspec = {} # used to do the klass.find propspec = {} # used to do the klass.find
for l in designator_propname.itervalues(): for l in designator_propname.values():
for propname in l: for propname in l:
propspec[propname] = {} # used as a set (value doesn't matter) propspec[propname] = {} # used as a set (value doesn't matter)
# don't unpack hits entries as sqlite3's Row can't be unpacked :( # don't unpack hits entries as sqlite3's Row can't be unpacked :(
for entry in hits: for entry in hits:
# skip this result if we don't care about this class/property # skip this result if we don't care about this class/property
classname = entry[0] classname = entry[0]
property = entry[2] property = entry[2]
if (classname, property) in ignore: if (classname, property) in ignore:
continue continue
skipping to change at line 115 skipping to change at line 115
node_dict[linkprop] = [nodeid] node_dict[linkprop] = [nodeid]
else: else:
node_dict[linkprop].append(nodeid) node_dict[linkprop].append(nodeid)
return nodeids return nodeids
def get_indexer(config, db): def get_indexer(config, db):
indexer_name = getattr(config, "INDEXER", "") indexer_name = getattr(config, "INDEXER", "")
if not indexer_name: if not indexer_name:
# Try everything # Try everything
try: try:
from indexer_xapian import Indexer from .indexer_xapian import Indexer
return Indexer(db) return Indexer(db)
except ImportError: except ImportError:
pass pass
try: try:
from indexer_whoosh import Indexer from .indexer_whoosh import Indexer
return Indexer(db) return Indexer(db)
except ImportError: except ImportError:
pass pass
indexer_name = "native" # fallback to native full text search indexer_name = "native" # fallback to native full text search
if indexer_name == "xapian": if indexer_name == "xapian":
from indexer_xapian import Indexer from .indexer_xapian import Indexer
return Indexer(db) return Indexer(db)
if indexer_name == "whoosh": if indexer_name == "whoosh":
from indexer_whoosh import Indexer from .indexer_whoosh import Indexer
return Indexer(db) return Indexer(db)
if indexer_name == "native": if indexer_name == "native":
# load proper native indexing based on database type # load proper native indexing based on database type
if db.dbtype == "anydbm": if db.dbtype == "anydbm":
from roundup.backends.indexer_dbm import Indexer from roundup.backends.indexer_dbm import Indexer
return Indexer(db) return Indexer(db)
if db.dbtype in ("sqlite", "postgres", "mysql"): if db.dbtype in ("sqlite", "postgres", "mysql"):
from roundup.backends.indexer_rdbms import Indexer from roundup.backends.indexer_rdbms import Indexer
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)