X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=roundup%2Findexer.py;h=e4d1d59b02c186e522b9b3addc707bd52ffe7c6a;hb=b720a9e098b96974558c3ad1538bec76b60bff90;hp=814425a5848798585704549ad35f965be45e19c8;hpb=c962438200659241361343528c1f31130fa0e7ca;p=roundup.git diff --git a/roundup/indexer.py b/roundup/indexer.py index 814425a..e4d1d59 100644 --- a/roundup/indexer.py +++ b/roundup/indexer.py @@ -14,7 +14,7 @@ # that promote freedom, but obviously am giving up any rights # to compel such. # -#$Id: indexer.py,v 1.10 2002-07-14 23:17:24 richard Exp $ +#$Id: indexer.py,v 1.14 2002-09-25 05:06:14 richard Exp $ ''' This module provides an indexer class, RoundupIndexer, that stores text indices in a roundup instance. This class makes searching the content of @@ -49,7 +49,7 @@ class Indexer: elif os.path.exists(version): version = open(version).read() # check the value and reindex if it's not the latest - if version != '1': + if version.strip() != '1': self.force_reindex() def force_reindex(self): @@ -169,6 +169,10 @@ class Indexer: nodeids[nodeid] = {} continue + # make sure the class is a linked one, otherwise ignore + if not designator_propname.has_key(classname): + continue + # it's a linked class - set up to do the klass.find linkprop = designator_propname[classname] # eg, msg -> messages propspec[linkprop][nodeid] = 1 @@ -312,6 +316,8 @@ class Indexer: def purge_entry(self, identifier): ''' Remove a file from file index and word index ''' + self.load_index() + if not self.files.has_key(identifier): return @@ -331,71 +337,4 @@ class Indexer: return (hasattr(self,'fileids') and hasattr(self,'files') and hasattr(self,'words')) -# -#$Log: not supported by cvs2svn $ -#Revision 1.9 2002/07/14 06:11:16 richard -#Some TODOs -# -#Revision 1.8 2002/07/09 21:53:38 gmcm -#Optimize Class.find so that the propspec can contain a set of ids to match. -#This is used by indexer.search so it can do just one find for all the index matches. -#This was already confusing code, but for common terms (lots of index matches), -#it is enormously faster. -# -#Revision 1.7 2002/07/09 21:38:43 richard -#Only save the index if the thing is loaded and changed. Also, don't load -#the index just for a save. -# -#Revision 1.6 2002/07/09 04:26:44 richard -#We're indexing numbers now, and _underscore words -# -#Revision 1.5 2002/07/09 04:19:09 richard -#Added reindex command to roundup-admin. -#Fixed reindex on first access. -#Also fixed reindexing of entries that change. -# -#Revision 1.4 2002/07/09 03:02:52 richard -#More indexer work: -#- all String properties may now be indexed too. Currently there's a bit of -# "issue" specific code in the actual searching which needs to be -# addressed. In a nutshell: -# + pass 'indexme="yes"' as a String() property initialisation arg, eg: -# file = FileClass(db, "file", name=String(), type=String(), -# comment=String(indexme="yes")) -# + the comment will then be indexed and be searchable, with the results -# related back to the issue that the file is linked to -#- as a result of this work, the FileClass has a default MIME type that may -# be overridden in a subclass, or by the use of a "type" property as is -# done in the default templates. -#- the regeneration of the indexes (if necessary) is done once the schema is -# set up in the dbinit. -# -#Revision 1.3 2002/07/08 06:58:15 richard -#cleaned up the indexer code: -# - it splits more words out (much simpler, faster splitter) -# - removed code we'll never use (roundup.roundup_indexer has the full -# implementation, and replaces roundup.indexer) -# - only index text/plain and rfc822/message (ideas for other text formats to -# index are welcome) -# - added simple unit test for indexer. Needs more tests for regression. -# -#Revision 1.2 2002/05/25 07:16:24 rochecompaan -#Merged search_indexing-branch with HEAD -# -#Revision 1.1.2.3 2002/05/02 11:52:12 rochecompaan -#Fixed small bug that prevented indexes from being generated. -# -#Revision 1.1.2.2 2002/04/19 19:54:42 rochecompaan -#cgi_client.py -# removed search link for the time being -# moved rendering of matches to htmltemplate -#hyperdb.py -# filtering of nodes on full text search incorporated in filter method -#roundupdb.py -# added paramater to call of filter method -#roundup_indexer.py -# added search method to RoundupIndexer class -# -#Revision 1.1.2.1 2002/04/03 11:55:57 rochecompaan -# . Added feature #526730 - search for messages capability -# +# vim: set filetype=python ts=4 sw=4 et si