[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/index - __init__.py:1.2 interfaces.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:14:00 -0500
Update of /cvs-repository/Zope3/src/zope/app/interfaces/index
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/interfaces/index
Added Files:
__init__.py interfaces.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/interfaces/index/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/interfaces/index/__init__.py Wed Dec 25 09:12:59 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/interfaces/index/interfaces.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/interfaces/index/interfaces.py Wed Dec 25 09:12:59 2002
@@ -0,0 +1,87 @@
+##############################################################################
+#
+# Copyright (c) 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+#
+##############################################################################
+"""Standard interfaces for using the query service.
+
+The query service provides a set of interfaces for articulating queries. You
+can create complex queries by implementing multiple interfaces like
+IBatchedQuery and ITextIndexQuery to ask the TextIndex for a batched query.
+The lookup for the query processor will try to find an appropriate adapter to
+the index.
+
+$Id$
+"""
+
+from zope.interface import Interface, Attribute
+
+class IQueryDescription(Interface):
+ """An interface the describes the input or output of a
+ query processor.
+
+ There should exist an adapter that adapts the type we
+ are describing to an object that implements this interface.
+ """
+
+class ITextIndexQuery(IQueryDescription):
+ """A unicode query string that's compatible to the TextIndex
+ syntax.
+ """
+
+ textIndexQuery = Attribute("The query.")
+
+class IBatchedQuery(Interface):
+
+ startPosition = Attribute("The first element of the batch.")
+ batchSize = Attribute("The size of the batch.")
+
+class IBatchedTextIndexQuery(IBatchedQuery, ITextIndexQuery):
+ pass
+
+class IBatchedResult(IBatchedQuery):
+
+ totalSize = Attribute("The total size of the result set if known.")
+
+class IHubIdSet(IQueryDescription):
+ """Contains an IISet or IOSet of HubIds.
+ """
+
+ iset = Attribute("The set of HubIds.")
+
+class IRankedHubIdList(IQueryDescription):
+ """Describes a sequence of tuples (hubid, rank) where
+ rank is a float between 0 and 1 inclusive.
+ """
+
+ def __getitem__(index):
+ """Returns a tuple (hubid, rank) with that index."""
+
+class IInstrumentalQuery(Interface):
+ """The original query in a form that was actually used.
+ """
+
+ instrumentalQuery = Attribute("Contains the instrumental query.")
+
+
+class IRankedObjectIterator(Interface):
+ """Provides an iterable presentation of ranked results
+ of a ranked query. Each item is implementing an IRankedObjectRecord.
+ """
+
+ def __iter__():
+ """Iterates over the results."""
+
+class IRankedObjectRecord(Interface):
+ """One item returned by the iterator."""
+
+ rank = Attribute("A float between 0 and 1 inclusive.")
+ object = Attribute("The object.")