Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
43d58b76
Commit
43d58b76
authored
11 years ago
by
Michael Hamann
Browse files
Options
Downloads
Patches
Plain Diff
Fix the snippet search to continue after the previous match
parent
ef3e3cdd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/fulltext.php
+6
-6
6 additions, 6 deletions
inc/fulltext.php
with
6 additions
and
6 deletions
inc/fulltext.php
+
6
−
6
View file @
43d58b76
...
...
@@ -354,12 +354,12 @@ function ft_snippet($id,$highlight){
}
// set $offset for next match attempt
//
substract strlen to avoid splitting a potential search success,
//
th
is is an approximation as the search pattern may match strings
//
of varying length and it will fail if the context snippet
//
boundary breaks a matching string longer than the current match
$utf8_offset
=
$utf8_idx
+
$
post
;
$offset
=
$idx
+
strlen
(
utf8_substr
(
$text
,
$utf8_idx
,
$
post
));
//
continue matching after the current match
//
if
th
e current match is not the longest possible match starting at the current offset
//
this prevents further matching of this snippet but for possible matches of length
//
smaller than match length + context (at least 50 characters) this match is part of the context
$utf8_offset
=
$utf8_idx
+
$
utf8_len
;
$offset
=
$idx
+
strlen
(
utf8_substr
(
$text
,
$utf8_idx
,
$
utf8_len
));
$offset
=
utf8_correctIdx
(
$text
,
$offset
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment