-
-
Notifications
You must be signed in to change notification settings - Fork 840
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
Better core search #2286
Merged
Merged
Better core search #2286
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
21fcef8
refactor(Search): refactor html_search into Ui/Search
micgro42 427ed98
feat(Search): Add search form on results page
micgro42 bb8ef86
feat(search): add search assistance for simple queries
micgro42 4eab6f7
feat(search): trigger event for each result
micgro42 81a0edd
feat(search): trigger event for search form modification
micgro42 44156e1
feat: add a simple unparser for parsed search queries
micgro42 4c924eb
feat(search): add link to restrict search to result namespace
micgro42 3c7a332
refactor: make tpl_seachform use dokuwiki\Form
micgro42 cbcc2fa
feat(search): add origin page as parameter
micgro42 d09b5b6
feat(search): add config options to adjust default behavior
micgro42 4d0cb6e
feat(search): show search adjustments as links
micgro42 e5bf110
feat(search): remember assistance's open/closed state
micgro42 3eb2b86
fix: readd div with no-class to tpl_searchform
micgro42 de3383c
fix(search): namespace limits must match exactly
micgro42 9a75abf
feat: show last mod information in search results
micgro42 bbc1da2
feat(search): filter results by lastmod time
micgro42 d22b78c
feat(search): use dedicated url-parameter for search query
micgro42 b3cfe85
fix(search): also filter pagename results by time
micgro42 940f24f
fix(search): don't truncate namespaces with - and . in pagename-lookup
micgro42 1b48999
refactor(search): move filtering by time into _ft_page*
micgro42 18856c5
refactor(search): extract simplified SearchState class
micgro42 8d0e286
feat(search) add option to sort by mtime
micgro42 6639a15
refactor(search) run the search from Action/Search, not Ui/Search
micgro42 b005809
feat(search): display search tools as lists on click
micgro42 01c23ba
l10n(search): en translation for new search functionality
micgro42 df97724
feat(search) more nuanced tool deactivation
micgro42 c6b5b74
fix(search): detect irregular fragment query
micgro42 5facb9b
feat(Form): add method to get position of element by element
micgro42 340f849
fix(search): remove overlook from parameter
micgro42 1265b19
refactor(search): shorten get parameters
micgro42 16ece95
feat(search): trigger new event for small search field form
micgro42 4bdf82b
first go at styling
splitbrain 55dc878
fix(search): sort list of namespaces alphabetical in 2nd order
micgro42 2ce8aff
l10n(search): Add link to create page from query to searchintro
micgro42 52d4cd4
refactor(search): rewite SearchState to make behavior more obvious
micgro42 3850270
refactor(search): provide before/after arguments to search event
micgro42 c5bd572
l10n(search): localization for the toggle tools button
micgro42 220966d
fix: display "show" item in page menu during search action
micgro42 3286c65
fix(search): don't search for current page if submitting empty form
micgro42 7fa270b
feat(Form): add parameter to omit security token in forms
micgro42 be76738
doc(search): add missing PHP doc blocks
micgro42 c6070d6
refactor search.less
splitbrain 0fc3880
use relative time in search results
splitbrain 1d91889
more styling and RTL support
splitbrain 2171f9c
added aria attributes
splitbrain c2d6156
removed sub header from all languages
splitbrain a00078f
adjusted language files to remove outdated string
splitbrain 826e222
show adavanced tools with JavaScript only
splitbrain fc46ed5
doc(search): highlight is expected to be an array
micgro42 ec27794
doc(search): parameter must be string or false
micgro42 422bbbc
refactor: rename dta and dtb parameters
micgro42 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
|
||
// must be run within Dokuwiki | ||
if (!defined('DOKU_INC')) { | ||
die(); | ||
} | ||
|
||
/** | ||
* Test cases for the link index | ||
* | ||
* @author Michael Große <grosse@cosmocode.de> | ||
* | ||
* @group fulltext | ||
*/ | ||
class fulltext_query_test extends DokuWikiTest | ||
{ | ||
public function test_parse_query() | ||
{ | ||
$Indexer = idx_get_indexer(); | ||
$inputQuery = 'test -baz "foo bar" @abc ^def'; | ||
|
||
$actualParsedQuery = ft_queryParser($Indexer, $inputQuery); | ||
|
||
$expectedParsedQuery = [ | ||
'query' => 'test -baz "foo bar" @abc ^def', | ||
'parsed_str' => '(W+:test)ANDNOT((W-:baz))AND((W_:foo)AND(W_:bar)AND(P+:foo bar))AND(N+:abc)ANDNOT(N-:def)', | ||
'parsed_ary' => [ | ||
'W+:test', | ||
'W-:baz', | ||
'NOT', | ||
'AND', | ||
'W_:foo', | ||
'W_:bar', | ||
'AND', | ||
'P+:foo bar', | ||
'AND', | ||
'AND', | ||
'N+:abc', | ||
'AND', | ||
'N-:def', | ||
'NOT', | ||
'AND', | ||
], | ||
'words' => [ | ||
'test', | ||
'baz', | ||
'foo', | ||
'bar', | ||
], | ||
'highlight' => [ | ||
'test', | ||
'foo bar', | ||
], | ||
'and' => [ | ||
'test', | ||
], | ||
'phrases' => [ | ||
'foo bar', | ||
], | ||
'ns' => [ | ||
'abc', | ||
], | ||
'notns' => [ | ||
'def', | ||
], | ||
'not' => [ | ||
'baz', | ||
], | ||
]; | ||
$this->assertEquals($expectedParsedQuery, $actualParsedQuery); | ||
} | ||
|
||
public function test_unparse_query() | ||
{ | ||
$input = [ | ||
'and' => [ | ||
'test', | ||
], | ||
'not' => [ | ||
'baz' | ||
], | ||
'phrases' => [ | ||
'foo bar', | ||
], | ||
'ns' => [ | ||
'abc', | ||
], | ||
'notns' => [ | ||
'def' | ||
], | ||
]; | ||
|
||
$actualQuery = ft_queryUnparser_simple( | ||
$input['and'], | ||
$input['not'], | ||
$input['phrases'], | ||
$input['ns'], | ||
$input['notns'] | ||
); | ||
|
||
$expectedQuery = 'test -baz "foo bar" @abc ^def'; | ||
$this->assertEquals($expectedQuery, $actualQuery); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already set global at the top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. This is an anonymous function within
array_map