Skip to content

Optional * wildcard for text search - #1638

Open
DominikNetcare wants to merge 14 commits into
unclebob:masterfrom
netcare-io:feature/search-wildcards
Open

DominikNetcare wants to merge 14 commits into
unclebob:masterfrom
netcare-io:feature/search-wildcards

Conversation

@DominikNetcare

@DominikNetcare DominikNetcare commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Text search was always literal: * found pages containing an asterisk and there was no way to search with wildcards (the RestfulServices page says so: "this is a string, not a regular expression"). A new Use wildcards (*) option on the text search tab (useWildcards input) makes * match any characters within a line, in title and content search; * alone finds all pages in the search scope.

Depends on #1637, please merge after it (stacked on #1637 and #1636, shows their commits too until they are merged); the changes of this PR alone: netcare-io/fitnesse@feature/search-performance...feature/search-wildcards

After #1637 is merged, I'll update this branch right away (merging master into it), so it merges cleanly.

Changes

  • SearchResponder turns the search text into a case insensitive pattern: the parts between * are quoted literally, * becomes .* (no DOTALL, so a wildcard does not span lines).
  • TitleWikiPageFinder accepts a Pattern, like RegularExpressionWikiPageFinder.
  • Without the option nothing changes: the search text is matched literally exactly as before, so existing links and REST queries keep their results.
  • The option is only offered for text search; method search needs an exact wiki line.
  • Docs: useWildcards added to the RestfulServices page, release note added.

No performance impact.

Tests

Unit tests for the pattern, wildcard title and content search, * alone, and the literal search without the option. Unit tests and FitNesse.SuiteAcceptanceTests pass.

Text, method and properties search no longer follow symbolic links
unless "Include symbolic links" is checked (includeSymLinks input).
Following links finds the same pages again under other paths and can
make searches on large wikis slow. A search that starts at a symbolic
link still covers the linked pages.

The search results show whether a page is reached via a symbolic link,
mark every symbolic link in the page path and report how long the
search took.
Search and replace uses the search code, which now skips symbolic links by default. Replace has always changed the pages behind symbolic links too, and its form offers no option to include them, so it keeps doing so.
Finding the children of a page read the page data (content and
properties) to look up symbolic links, so even a title search read
every page file. Pages can now list their children without symbolic
links (WikiPage.getChildrenWithoutSymbolicLinks), which file based
pages do from the directory listing alone. Traversals use it when the
pruning strategy skips symbolic links.

Also stop looking up a symbolic link for every non-page file in a page
directory: symbolic links are collected from the properties anyway.

On a wiki with 50,000 pages, title search went from ~2.5s to ~1.3s.
Text, method and properties search accept a searchThreads input (1-4,
"Threads" on the search form). With more than one thread, the children
and page data of the pages to visit are loaded ahead on worker threads,
while pages are still matched and reported one at a time, on the
request thread and in the same order. 1, the default, searches
sequentially as before.

On a wiki with 50,000 pages, 4 threads made content and properties
search about 2.3 times and title search about 1.9 times faster.

# Conflicts:
#	src/fitnesse/responders/search/ResultResponder.java
The REST API still searches with one thread unless searchThreads is given.
Replace changes pages while traversing them, so pages must not be loaded ahead.
With "Use wildcards" checked (useWildcards input), an asterisk in the
search text matches any characters within a line, in title and content
search; * alone finds all pages in the search scope. Without it the
search text is still matched literally.
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.

1 participant