Exemplo n.º 1
0
    def _apply_index(self, request, cid=''):
        """Apply the index to the search parameters given in request"""

        record = parseIndexRequest(request, self.id, self.query_options)
        if record.keys is None:
            return None

        result = None
        fallback = self.fallback
        if hasattr(record, 'fallback'):
            fallback = bool(record.fallback)

        for language in record.keys:
            rows = self._search(language, fallback)
            result = ii_union(result, rows)

        return (result or IISet()), ('Language', )
def languageindex_apply_index(self, request, cid='', res=None):
    """Apply the index to the search parameters given in request"""

    record = parseIndexRequest(request, self.id, self.query_options)
    if record.keys is None:
        return None

    result = None
    fallback = self.fallback
    if hasattr(record, 'fallback'):
        fallback = bool(record.fallback)

    # TODO: This could be optimized to avoid a loop per language
    # As we most often get a language code and '' for language neutral this
    # could be beneficial. If the site has no language neutral content, the
    # first check "main not in self._index" will return None. The union of
    # None with the resultset is a cheap call, so we don't care right now.
    for language in record.keys:
        rows = self._search(language, fallback, res=res)
        result = ii_union(result, rows)

    return (result or IISet()), ('Language',)
def languageindex_apply_index(self, request, cid='', res=None):
    """Apply the index to the search parameters given in request"""

    record = parseIndexRequest(request, self.id, self.query_options)
    if record.keys is None:
        return None

    result = None
    fallback = self.fallback
    if hasattr(record, 'fallback'):
        fallback = bool(record.fallback)

    # TODO: This could be optimized to avoid a loop per language
    # As we most often get a language code and '' for language neutral this
    # could be beneficial. If the site has no language neutral content, the
    # first check "main not in self._index" will return None. The union of
    # None with the resultset is a cheap call, so we don't care right now.
    for language in record.keys:
        rows = self._search(language, fallback, res=res)
        result = ii_union(result, rows)

    return (result or IISet()), ('Language', )
Exemplo n.º 4
0
 def __or__(self, x):
     return self.__class__(
         ii_union(self._dict, x._dict),
         union(self._words, x._words),
         self._index,
     )
Exemplo n.º 5
0
 def __or__(self, x):
     return self.__class__(
         ii_union(self._dict, x._dict),
         union(self._words, x._words),
         self._index,
         )