Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a custom separator to improve search results in the documentation #4383

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

jacekwegr
Copy link
Collaborator

@jacekwegr jacekwegr commented Oct 17, 2024

This PR adds a custom separator regex to the MkDocs search plugin to improve how search works. It helps split text into searchable pieces, which is important for technical content like code, settings and XMPP stanzas.

How the Regex Works

  • [\s\-_,:!=\[\]()"/<>]+: Matches spaces, punctuation, and special characters like underscores.
  • \.(?!\d): Splits at periods, but not if they’re part of a decimal number.
  • &[lg]t;: Matches HTML entities like &lt; and &gt;.

It makes searching for configuration options easier. For example, you can now find modules.mod_mam.pm.same_mam_id_for_peers by searching for parts like same_mam_id_for_peers, id_for_peers, or even mam peers. Also, XMPP stanzas are now included in the results. So, if you search for presence, you’ll see results like <presence/> and <presence type="unavailable"></presence>.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Oct 17, 2024

elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 5a22f03
Reports root/ big
OK: 473 / Failed: 0 / User-skipped: 49 / Auto-skipped: 0


small_tests_26 / small_tests / 5a22f03
Reports root / small


small_tests_27 / small_tests / 5a22f03
Reports root / small


small_tests_27_arm64 / small_tests / 5a22f03
Reports root / small


ldap_mnesia_26 / ldap_mnesia / 5a22f03
Reports root/ big
OK: 2346 / Failed: 0 / User-skipped: 910 / Auto-skipped: 0


ldap_mnesia_27 / ldap_mnesia / 5a22f03
Reports root/ big
OK: 2346 / Failed: 0 / User-skipped: 910 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 5a22f03
Reports root/ big
OK: 4718 / Failed: 0 / User-skipped: 152 / Auto-skipped: 0


internal_mnesia_27 / internal_mnesia / 5a22f03
Reports root/ big
OK: 2488 / Failed: 0 / User-skipped: 768 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 5a22f03
Reports root/ big
OK: 4751 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 5a22f03
Reports root/ big
OK: 4748 / Failed: 0 / User-skipped: 122 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 5a22f03
Reports root/ big
OK: 4751 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 5a22f03
Reports root/ big
OK: 4628 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 5a22f03
Reports root/ big
OK: 5122 / Failed: 1 / User-skipped: 147 / Auto-skipped: 0

sm_SUITE:ws_tests:ping_timeout
{error,{{badmatch,false},
    [{escalus_session,stream_resumption,2,
              [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_session.erl"},
               {line,259}]},
     {escalus_connection,connection_step,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,161}]},
     {lists,foldl_1,3,[{file,"lists.erl"},{line,2151}]},
     {escalus_connection,start,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,145}]},
     {sm_helper,connect_spec,3,
          [{file,"/home/circleci/project/big_tests/tests/sm_helper.erl"},
           {line,154}]},
     {sm_SUITE,ping_timeout,1,
           [{file,"/home/circleci/project/big_tests/tests/sm_SUITE.erl"},
          {line,656}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1303}]}]}}

Report log


cockroachdb_cets_27 / cockroachdb_cets / 5a22f03
Reports root/ big
OK: 4628 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 5a22f03
Reports root/ big
OK: 5142 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


pgsql_mnesia_27 / pgsql_mnesia / 5a22f03
Reports root/ big
OK: 5142 / Failed: 0 / User-skipped: 128 / Auto-skipped: 0


mssql_mnesia_27 / odbc_mssql_mnesia / 5a22f03
Reports root/ big
OK: 5139 / Failed: 0 / User-skipped: 131 / Auto-skipped: 0


mysql_redis_27 / mysql_redis / 5a22f03
Reports root/ big
OK: 5122 / Failed: 1 / User-skipped: 147 / Auto-skipped: 0

sm_SUITE:tcp_tests:ping_timeout
{error,{{assertion_failed,assert,is_presence,
              {xmlel,<<"r">>,
                 [{<<"xmlns">>,<<"urn:xmpp:sm:3">>}],
                 []},
              "<r xmlns='urn:xmpp:sm:3'/>"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {sm_helper,initial_presence_step,2,
          [{file,"/home/circleci/project/big_tests/tests/sm_helper.erl"},
           {line,136}]},
     {escalus_connection,connection_step,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,163}]},
     {lists,foldl_1,3,[{file,"lists.erl"},{line,2151}]},
     {escalus_connection,start,2,
               [{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,145}]},
     {sm_helper,connect_spec,3,
          [{file,"/home/circleci/project/big_tests/tests/sm_helper.erl"},
           {line,154}]},
     {sm_SUITE,ping_timeout,1,
           [{file,"/home/circleci/project/big_tests/tests/sm_SUITE.erl"},
          {line,656}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]}]}}

Report log


mysql_redis_27 / mysql_redis / 5a22f03
Reports root/ big
OK: 5123 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.26%. Comparing base (b6e6da2) to head (5a22f03).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4383      +/-   ##
==========================================
+ Coverage   85.18%   85.26%   +0.07%     
==========================================
  Files         550      550              
  Lines       33842    33842              
==========================================
+ Hits        28829    28855      +26     
+ Misses       5013     4987      -26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacekwegr jacekwegr marked this pull request as ready for review October 18, 2024 09:13
@jacekwegr jacekwegr changed the title Add custom separator to improve search results in documentation Add a custom separator to improve search results in the documentation Oct 18, 2024
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nice to see the search function improved.

@chrzaszcz chrzaszcz merged commit 1e890ff into master Oct 18, 2024
4 checks passed
@chrzaszcz chrzaszcz deleted the improve-docs-search branch October 18, 2024 13:39
@jacekwegr jacekwegr added this to the 6.3.0 milestone Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants