mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 13:33:24 +00:00 
			
		
		
		
	pgroonga: Re-enable PGroonga in development.
This partially reverts commit fdabf0b357
(#21104).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							9c8d2b7be3
						
					
				
				
					commit
					12da3ac0ad
				
			@@ -1,7 +1,7 @@
 | 
			
		||||
import datetime
 | 
			
		||||
import os
 | 
			
		||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
 | 
			
		||||
from unittest import mock, skip
 | 
			
		||||
from unittest import mock
 | 
			
		||||
 | 
			
		||||
import orjson
 | 
			
		||||
from django.db import connection
 | 
			
		||||
@@ -436,13 +436,11 @@ class NarrowBuilderTest(ZulipTestCase):
 | 
			
		||||
            "WHERE NOT (content ILIKE %(content_1)s OR subject ILIKE %(subject_1)s) AND NOT (search_tsvector @@ plainto_tsquery(%(param_4)s, %(param_5)s))",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @skip
 | 
			
		||||
    @override_settings(USING_PGROONGA=True)
 | 
			
		||||
    def test_add_term_using_search_operator_pgroonga(self) -> None:
 | 
			
		||||
        term = dict(operator="search", operand='"french fries"')
 | 
			
		||||
        self._do_add_term_test(term, "WHERE search_pgroonga &@~ escape_html(%(escape_html_1)s)")
 | 
			
		||||
 | 
			
		||||
    @skip
 | 
			
		||||
    @override_settings(USING_PGROONGA=True)
 | 
			
		||||
    def test_add_term_using_search_operator_and_negated_pgroonga(self) -> None:  # NEGATED
 | 
			
		||||
        term = dict(operator="search", operand='"french fries"', negated=True)
 | 
			
		||||
@@ -2305,7 +2303,6 @@ class GetOldMessagesTest(ZulipTestCase):
 | 
			
		||||
            '<p>Public <span class="highlight">special</span> content!</p>',
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @skip
 | 
			
		||||
    @override_settings(USING_PGROONGA=True)
 | 
			
		||||
    def test_get_messages_with_search_pgroonga(self) -> None:
 | 
			
		||||
        self.login("cordelia")
 | 
			
		||||
 
 | 
			
		||||
@@ -495,14 +495,14 @@ class NarrowBuilder:
 | 
			
		||||
        return query.where(maybe_negate(cond))
 | 
			
		||||
 | 
			
		||||
    def by_search(self, query: Select, operand: str, maybe_negate: ConditionTransform) -> Select:
 | 
			
		||||
        if settings.USING_PGROONGA:  # nocoverage
 | 
			
		||||
        if settings.USING_PGROONGA:
 | 
			
		||||
            return self._by_search_pgroonga(query, operand, maybe_negate)
 | 
			
		||||
        else:
 | 
			
		||||
            return self._by_search_tsearch(query, operand, maybe_negate)
 | 
			
		||||
 | 
			
		||||
    def _by_search_pgroonga(
 | 
			
		||||
        self, query: Select, operand: str, maybe_negate: ConditionTransform
 | 
			
		||||
    ) -> Select:  # nocoverage
 | 
			
		||||
    ) -> Select:
 | 
			
		||||
        match_positions_character = func.pgroonga_match_positions_character
 | 
			
		||||
        query_extract_keywords = func.pgroonga_query_extract_keywords
 | 
			
		||||
        operand_escaped = func.escape_html(operand, type_=Text)
 | 
			
		||||
@@ -574,7 +574,7 @@ def highlight_string(text: str, locs: Iterable[Tuple[int, int]]) -> str:
 | 
			
		||||
                in_tag = True
 | 
			
		||||
            elif character == ">":
 | 
			
		||||
                in_tag = False
 | 
			
		||||
        if in_tag:  # nocoverage
 | 
			
		||||
        if in_tag:
 | 
			
		||||
            result += prefix
 | 
			
		||||
            result += match
 | 
			
		||||
        else:
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ TERMS_OF_SERVICE_MESSAGE: Optional[str] = "Description of changes to the ToS!"
 | 
			
		||||
EMBEDDED_BOTS_ENABLED = True
 | 
			
		||||
 | 
			
		||||
SYSTEM_ONLY_REALMS: Set[str] = set()
 | 
			
		||||
USING_PGROONGA = False
 | 
			
		||||
USING_PGROONGA = True
 | 
			
		||||
# Flush cache after migration.
 | 
			
		||||
POST_MIGRATION_CACHE_FLUSHING = True
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user