This repository has been archived by the owner on May 13, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move IQueryParseTree to a separate file, to conform to style
guidelines. Added some conformance tests.
- Loading branch information
1 parent
a1ffe03
commit ae87725
Showing
5 changed files
with
83 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
############################################################################## | ||
# | ||
# 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. | ||
# | ||
############################################################################## | ||
|
||
"""Query Parser Tree Interface.""" | ||
|
||
import Interface | ||
|
||
class IQueryParseTree(Interface.Base): | ||
"""Interface for parse trees returned by parseQuery().""" | ||
|
||
def nodeType(): | ||
"""Return the node type. | ||
This is one of 'AND', 'OR', 'NOT', 'ATOM', 'PHRASE' or 'GLOB'. | ||
""" | ||
|
||
def getValue(): | ||
"""Return a node-type specific value. | ||
For node type: Return: | ||
'AND' a list of parse trees | ||
'OR' a list of parse trees | ||
'NOT' a parse tree | ||
'ATOM' a string (representing a single search term) | ||
'PHRASE' a string (representing a search phrase) | ||
'GLOB' a string (representing a pattern, e.g. "foo*") | ||
""" | ||
|
||
def terms(): | ||
"""Return a list of all terms in this node, excluding NOT subtrees.""" | ||
|
||
def executeQuery(index): | ||
"""Execute the query represented by this node against the index. | ||
The index argument must implement the IIndex interface. | ||
Return an IIBucket or IIBTree mapping document ids to scores | ||
(higher scores mean better results). | ||
May raise ParseTree.QueryError. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters