chiark / gitweb /
documentation: trim overly long search results even more.
authorVladimír Vondruš <mosra@centrum.cz>
Thu, 18 Jul 2019 13:24:55 +0000 (15:24 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 18 Jul 2019 15:41:49 +0000 (17:41 +0200)
The function name should be shown fully, ideally together with a
recognizable prefix.

documentation/doxygen.py
documentation/test_doxygen/test_search.py

index 4e4ac2a0d6d7f9059a496f63ef02073b20cec65e..ff918cb9e65bd8bbd1f5650aafb6e8f6406c9852 100755 (executable)
@@ -2317,15 +2317,15 @@ def build_search_data(state: State, merge_subtrees=True, add_lookahead_barriers=
                 # the suffix_length to exceed 256, which won't fit into the
                 # serialized search data. However that *also* won't fit in the
                 # search result list so there's no point in storing so much.
-                # Truncate it to 65 chars which could fit at least a part of
-                # the function name in the list in most cases, yet be still
-                # long enough to be able to distinguish particular overloads.
+                # Truncate it to 48 chars which should fit the full function
+                # name in the list in most cases, yet be still long enough to
+                # be able to distinguish particular overloads.
                 # TODO: the suffix_length has to be calculated on UTF-8 and I
                 # am (un)escaping a lot back and forth here -- needs to be
                 # cleaned up
                 params = html.unescape(strip_tags(', '.join(result.params)))
-                if len(params) > 65:
-                    params = params[:64] + '…'
+                if len(params) > 49:
+                    params = params[:48] + '…'
                 name_with_args += '(' + html.escape(params) + ')'
                 suffix_length += len(params.encode('utf-8')) + 2
             if hasattr(result, 'suffix') and result.suffix:
index 4ed0a3c49c540a3e486925bf16525d2177939ce6..3cb23713d3bf26450434d9fad51d0e008c559daa 100755 (executable)
@@ -235,7 +235,7 @@ class SearchLongSuffixLength(IntegrationTestCase):
             serialized = f.read()
             search_data_pretty = pretty_print(serialized, entryTypeClass=EntryType)[0]
         #print(search_data_pretty)
-        self.assertEqual(len(serialized), 489)
+        self.assertEqual(len(serialized), 473)
         # The parameters get cut off with an ellipsis
         self.assertEqual(search_data_pretty, """
 2 symbols
@@ -247,8 +247,8 @@ file.h [2]
 averylongfunctionname [0]
 |                    ($
 |                     ) [1]
-0: ::aVeryLongFunctionName(const std::reference_wrapper<const std::vector<std::string>>&, c…) [prefix=2[:12], suffix_length=69, type=FUNC] -> #a1e9a11887275938ef5541070955c9d9c
-1:  [prefix=0[:46], suffix_length=67, type=FUNC] ->
+0: ::aVeryLongFunctionName(const std::reference_wrapper<const std::vector<s…) [prefix=2[:12], suffix_length=53, type=FUNC] -> #a1e9a11887275938ef5541070955c9d9c
+1:  [prefix=0[:46], suffix_length=51, type=FUNC] ->
 2: File.h [type=FILE] -> File_8h.html
 (EntryType.PAGE, CssClass.SUCCESS, 'page'),
 (EntryType.NAMESPACE, CssClass.PRIMARY, 'namespace'),