Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
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
Essem
Sharkey
Commits
7cf4aa9f
Commit
7cf4aa9f
authored
7 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
#1034
parent
020ce794
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/endpoints/posts/search.ts
+16
-8
16 additions, 8 deletions
src/api/endpoints/posts/search.ts
src/web/docs/search.ja.pug
+5
-0
5 additions, 0 deletions
src/web/docs/search.ja.pug
with
21 additions
and
8 deletions
src/api/endpoints/posts/search.ts
+
16
−
8
View file @
7cf4aa9f
...
...
@@ -97,14 +97,22 @@ async function byNative(res, rej, me, text, userId, following, mute, reply, repo
const
push
=
x
=>
q
.
$and
.
push
(
x
);
if
(
text
)
{
push
({
$and
:
text
.
split
(
'
'
).
map
(
x
=>
({
// キーワードが-で始まる場合そのキーワードを除外する
text
:
x
[
0
]
==
'
-
'
?
{
$not
:
new
RegExp
(
escapeRegexp
(
x
.
substr
(
1
)))
}
:
new
RegExp
(
escapeRegexp
(
x
))
}))
});
// 完全一致検索
if
(
/"""
(
.+
?)
"""/
.
test
(
text
))
{
const
x
=
text
.
match
(
/"""
(
.+
?)
"""/
)[
1
];
push
({
text
:
x
});
}
else
{
push
({
$and
:
text
.
split
(
'
'
).
map
(
x
=>
({
// キーワードが-で始まる場合そのキーワードを除外する
text
:
x
[
0
]
==
'
-
'
?
{
$not
:
new
RegExp
(
escapeRegexp
(
x
.
substr
(
1
)))
}
:
new
RegExp
(
escapeRegexp
(
x
))
}))
});
}
}
if
(
userId
)
{
...
...
This diff is collapsed.
Click to expand it.
src/web/docs/search.ja.pug
+
5
−
0
View file @
7cf4aa9f
...
...
@@ -11,6 +11,11 @@ section
p 例えば、「gitというキーワードを含むが、コミットというキーワードは含まない投稿」を検索したい場合、クエリは以下のようになります:
code git -コミット
section
h2 完全一致
p テキストを「"""」で囲むと、そのテキストと完全に一致する投稿を検索します。
p 例えば、「"""にゃーん"""」と検索すると、「にゃーん」という投稿のみがヒットし、「にゃーん…」という投稿はヒットしません。
section
h2 オプション
p
...
...
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