m *Ec@sdZdklZdklZdefdYZdefdYZdefdYZd efd YZd efd YZ d efdYZ defdYZ defdYZ defdYZ defdYZdS(sUPluginIndexes z3 interfaces. $Id: interfaces.py 33294 2005-07-13 10:56:36Z yuppie $ (s Interface(sBooltIPluggableIndexcBsYtZdZddZdZddZdZddZdZ d Z RS( NcCsdS(sReturn Id of index.N((((t@/data/zmath/zope/lib/python/Products/PluginIndexes/interfaces.pytgetIdscCsdS(s/Get all information contained for 'documentId'.N((t documentIdtdefault((RtgetEntryForObjectscCsdS(sIGet a sequence of attribute names that are indexed by the index. N((((RtgetIndexSourceNamesscCsdS(sIndex an object. 'documentId' is the integer ID of the document. 'obj' is the object to be indexed. 'threshold' is the number of words to process between committing subtransactions. If None, subtransactions are disabled. N((Rtobjt threshold((Rt index_object"scCsdS(s%Remove the documentId from the index.N((R((Rtunindex_object+stcCsdS(sApply the index to query parameters given in 'request'. The argument should be a mapping object. If the request does not contain the needed parametrs, then None is returned. If the request contains a parameter with the name of the column + "_usage", it is sniffed for information on how to handle applying the index. (Note: this style or parameters is deprecated) If the request contains a parameter with the name of the column and this parameter is either a Record or a class instance then it is assumed that the parameters of this index are passed as attribute (Note: this is the recommended way to pass parameters since Zope 2.4) Otherwise two objects are returned. The first object is a ResultSet containing the record numbers of the matching records. The second object is a tuple containing the names of all data fields used. N((trequesttcid((Rt _apply_index.scCsdS(s$Return the number of indexed objectsN((((Rt numObjectsFscCsdS(sEmpty the indexN((((RtclearMs( t__name__t __module__RtNoneRRR R RRR(((RRs      tIUniqueValueIndexcBs&tZdZdZeddZRS(s@An index which can return lists of unique values contained in itcCsdS(s>Return true if the index can return the unique values for nameN((tname((RthasUniqueValuesForTsicCsdS(s~Return the unique values for name. If 'withLengths' is true, returns a sequence of tuples of (value, length).N((Rt withLengths((Rt uniqueValuesWs(RRt__doc__RRR(((RRQs  t ISortIndexcBs tZdZdZdZRS(s8An index which may be used to sort a set of document idscCsdS(sReturn the sort key that cooresponds to the specified document id This method is no longer used by ZCatalog, but is left for backwards compatibility.N((R((RtkeyForDocumentascCsdS(suReturn an object that supports __getitem__ and may be used to quickly lookup the sort key given a document idN((((RtdocumentToKeyMapgs(RRRRR(((RR^s  t IDateIndexcBstZdZeddZRS(sIndex for dates. ttitleuIndex naive time as local?(RRRtBooltindex_naive_time_as_local(((RRls tIDateRangeIndexcBs tZdZdZdZRS(sIndex for date ranges, such as the "effective-expiration" range in CMF. Any object may return None for either the start or the end date: for the start date, this should be the logical equivalent of "since the beginning of time"; for the end date, "until the end of time". Therefore, divide the space of indexed objects into four containers: - Objects which always match (i.e., they returned None for both); - Objects which match after a given time (i.e., they returned None for the end date); - Objects which match until a given time (i.e., they returned None for the start date); - Objects which match only during a specific interval. cCsdS(s=Get the name of the attribute indexed as start date. N((((Rt getSinceFieldscCsdS(s;Get the name of the attribute indexed as end date. N((((Rt getUntilFields(RRRR"R#(((RR!ts  t IPathIndexcBstZdZRS(sIndex for paths returned by getPhysicalPath. A path index stores all path components of the physical path of an object. Internal datastructure: - a physical path of an object is split into its components - every component is kept as a key of a OOBTree in self._indexes - the value is a mapping 'level of the path component' to 'all docids with this path component on this level' (RRR(((RR$s t IVocabularycBstZdZRS(sFA Vocabulary is a user-managable realization of a Lexicon object. (RRR(((RR%s t ITextIndexcBstZdZedZRS(s-Full-text index. There is a ZCatalog UML model that sheds some light on what is going on here. '_index' is a BTree which maps word ids to mapping from document id to score. Something like: {'bob' : {1 : 5, 2 : 3, 42 : 9}} {'uncle' : {1 : 1}} The '_unindex' attribute is a mapping from document id to word ids. This mapping allows the catalog to unindex an object: {42 : ('bob', 'is', 'your', 'uncle') This isn't exactly how things are represented in memory, many optimizations happen along the way. cCsdS(s Get the Lexicon in use. N((tvocab_id((Rt getLexicons(RRRRR((((RR&s t IFilteredSetcBs)tZdZdZdZdZRS(s9A pre-calculated result list based on an expression. cCsdS(sGet the expression. N((((Rt getExpressionscCsdS(sEGet the IDs of all objects for which the expression is True. N((((RtgetIdsscCsdS(sSet the expression. N((texpr((Rt setExpressions(RRRR*R+R-(((RR)s   t ITopicIndexcBs)tZdZdZdZdZRS(sA TopicIndex maintains a set of FilteredSet objects. Every FilteredSet object consists of an expression and and IISet with all Ids of indexed objects that eval with this expression to 1. cCsdS(s"Add a FilteredSet object. N((t filter_idttypeFilteredSetR,((RtaddFilteredSetscCsdS(s@Delete the FilteredSet object specified by 'filter_id'. N((R/((RtdelFilteredSetscCsdS(s?Clear the FilteredSet object specified by 'filter_id'. N((R/((RtclearFilteredSets(RRRR1R2R3(((RR.s   N(Rtzope.interfacet Interfacet zope.schemaRRRRRR!R$R%R&R)R.( R)RR&RRR$RR.R5RR%R!((Rt?s  ;