Repository navigation
Optional * wildcard for text search - #1638
Open
DominikNetcare wants to merge 14 commits into
Open
DominikNetcare wants to merge 14 commits into
DominikNetcare wants to merge 14 commits into
Conversation
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.
…formance # Conflicts: # FitNesseRoot/FitNesse/ReleaseNotes/content.txt
# Conflicts: # FitNesseRoot/FitNesse/ReleaseNotes/content.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 (useWildcardsinput) 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
SearchResponderturns the search text into a case insensitive pattern: the parts between*are quoted literally,*becomes.*(noDOTALL, so a wildcard does not span lines).TitleWikiPageFinderaccepts aPattern, likeRegularExpressionWikiPageFinder.useWildcardsadded 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 andFitNesse.SuiteAcceptanceTestspass.