[Zope3-checkins]
SVN: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/
Moved the topic- and keyword-index interfaces into their own
interface modules
Jim Fulton
jim at zope.com
Tue Dec 7 17:54:00 EST 2004
Log message for revision 28581:
Moved the topic- and keyword-index interfaces into their own interface modules
Changed:
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/index.py
A Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/interfaces.py
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/tests.py
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/text/textindex.py
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/filter.py
U Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/index.py
A Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/interfaces.py
-=-
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -82,25 +82,6 @@
"""
-class IQuerying(Interface):
- """An index that can be queried by some text and returns a result set."""
-
- def query(querytext, start=0, count=None):
- """Execute a query.
-
- querytext: unicode, the query expression
- start: the first result to return (0-based)
- count: the maximum number of results to return (default: all)
- return: ([(docid, rank), ...], total)
-
- The return value is a tuple:
- matches: list of (int, float) tuples, docid and rank
- total: int, the total number of matches
-
- The matches list represents the requested batch. The ranks
- are floats between 0 and 1 (inclusive).
- """
-
class IStatistics(Interface):
"""An index that provides statistical information about itself."""
@@ -111,60 +92,6 @@
"""Return the number of words currently indexed."""
-class IKeywordQuerying(Interface):
- """Query over a set of keywords, seperated by white space."""
-
- def search(query, operator='and'):
- """Execute a search given by 'query' as a list/tuple of
- (unicode) strings against the index. 'operator' can be either
- 'and' or 'or' to search for all keywords or any keyword.
-
- Return an IISet of docids
- """
-
-class ITopicQuerying(Interface):
- """Query over topics, seperated by white space."""
-
- def search(query, operator='and'):
- """Execute a search given by 'query' as a list/tuple of filter ids.
- 'operator' can be 'and' or 'or' to search for matches in all
- or any filter.
-
- Return an IISet of docids
- """
-
-class ISimpleQuery(Interface):
- """A simple query interface."""
-
- def query(term, start=0, count=None):
- """Search for the given term, return a sequence of docids"""
-
-
-class ITopicFilteredSet(Interface):
- """Interface for filtered sets used by topic indexes."""
-
- def clear():
- """Remove all entries from the index."""
-
- def index_doc(docid, context):
- """Add an object's info to the index."""
-
- def unindex_doc(docid):
- """Remove an object with id 'docid' from the index."""
-
- def getId():
- """Return the id of the filter itself."""
-
- def setExpression(expr):
- """Set the filter expression, e.g. 'context.meta_type=='...'"""
-
- def getExpression():
- """Return the filter expression."""
-
- def getIds():
- """Return an IISet of docids."""
-
-
class INBest(Interface):
"""Interface for an N-Best chooser."""
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/index.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/index.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/index.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -23,7 +23,8 @@
from BTrees.Length import Length
from types import ListType, TupleType, StringTypes
-from zope.index.interfaces import IInjection, IKeywordQuerying, IStatistics
+from zope.index.interfaces import IInjection, IStatistics
+from zope.index.keyword.interfaces import IKeywordQuerying
from zope.interface import implements
class KeywordIndex(Persistent):
Copied: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/interfaces.py (from rev 28579, Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py)
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py 2004-12-07 18:23:58 UTC (rev 28579)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/interfaces.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Keyword-index search interface
+
+$Id$
+"""
+from zope.interface import Interface
+
+class IKeywordQuerying(Interface):
+ """Query over a set of keywords, seperated by white space."""
+
+ def search(query, operator='and'):
+ """Execute a search given by 'query' as a list/tuple of
+ (unicode) strings against the index. 'operator' can be either
+ 'and' or 'or' to search for all keywords or any keyword.
+
+ Return an IISet of docids
+ """
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/tests.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/tests.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/keyword/tests.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -16,7 +16,8 @@
from BTrees.IIBTree import IISet
from zope.index.keyword.index import KeywordIndex
-from zope.index.interfaces import IInjection, IStatistics, IKeywordQuerying
+from zope.index.interfaces import IInjection, IStatistics
+from zope.index.keyword.interfaces import IKeywordQuerying
from zope.interface.verify import verifyClass
class KeywordIndexTest(TestCase):
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/text/textindex.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/text/textindex.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/text/textindex.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -11,10 +11,8 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Text index wrapper.
+"""Text index.
-This exists to implement IInjection and IQuerying.
-
$Id$
"""
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/filter.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/filter.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/filter.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -16,7 +16,7 @@
$Id$
"""
from BTrees.IIBTree import IISet
-from zope.index.interfaces import ITopicFilteredSet
+from zope.index.topic.interfaces import ITopicFilteredSet
from zope.interface import implements
class FilteredSetBase(object):
Modified: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/index.py
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/index.py 2004-12-07 22:36:18 UTC (rev 28580)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/index.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -23,7 +23,8 @@
from types import ListType, TupleType, StringTypes
from zope.interface import implements
-from zope.index.interfaces import IInjection, ITopicQuerying
+from zope.index.interfaces import IInjection
+from zope.index.topic.interfaces import ITopicQuerying
class TopicIndex(Persistent):
Copied: Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/interfaces.py (from rev 28579, Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py)
===================================================================
--- Zope3/branches/jim-index-restructure-2004-12/src/zope/index/interfaces.py 2004-12-07 18:23:58 UTC (rev 28579)
+++ Zope3/branches/jim-index-restructure-2004-12/src/zope/index/topic/interfaces.py 2004-12-07 22:54:00 UTC (rev 28581)
@@ -0,0 +1,53 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Basic interfaces shared between different types of index.
+
+$Id$
+"""
+from zope.interface import Interface
+
+class ITopicQuerying(Interface):
+ """Query over topics, seperated by white space."""
+
+ def search(query, operator='and'):
+ """Execute a search given by 'query' as a list/tuple of filter ids.
+ 'operator' can be 'and' or 'or' to search for matches in all
+ or any filter.
+
+ Return an IISet of docids
+ """
+
+class ITopicFilteredSet(Interface):
+ """Interface for filtered sets used by topic indexes."""
+
+ def clear():
+ """Remove all entries from the index."""
+
+ def index_doc(docid, context):
+ """Add an object's info to the index."""
+
+ def unindex_doc(docid):
+ """Remove an object with id 'docid' from the index."""
+
+ def getId():
+ """Return the id of the filter itself."""
+
+ def setExpression(expr):
+ """Set the filter expression, e.g. 'context.meta_type=='...'"""
+
+ def getExpression():
+ """Return the filter expression."""
+
+ def getIds():
+ """Return an IISet of docids."""
More information about the Zope3-Checkins
mailing list