Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P2060
example_query.sql
Active
Public
Actions
Authored by
epriestley
on Jun 9 2017, 10:52 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F4996011: example_query.sql
Jun 9 2017, 10:52 PM
2017-06-09 22:52:29 (UTC+0)
Subscribers
None
USE
phabricator_search
;
SELECT
documentPHID
,
MAX
(
fieldScore
)
AS
documentScore
FROM
(
SELECT
document
.
phid
AS
documentPHID
,
IF
(
field
.
field
=
'titl'
,
1024
,
0
)
+
MATCH
(
corpus
,
stemmedCorpus
)
AGAINST
(
'\"http\"'
IN
BOOLEAN
MODE
)
AS
fieldScore
FROM
`
search_document
`
document
JOIN
`
search_documentfield
`
field
ON
field
.
phid
=
document
.
phid
JOIN
`
search_documentrelationship
`
AS
`
authorPHIDs
`
ON
`
authorPHIDs
`
.
phid
=
document
.
phid
AND
`
authorPHIDs
`
.
relation
=
'auth'
AND
`
authorPHIDs
`
.
relatedPHID
in
(
'PHID-USER-ba8aeea1b3fe2853d6bb'
)
JOIN
`
search_documentrelationship
`
AS
`
statuses
`
ON
`
statuses
`
.
phid
=
document
.
phid
AND
`
statuses
`
.
relation
=
'open'
WHERE
MATCH
(
corpus
,
stemmedCorpus
)
AGAINST
(
'\"http\"'
IN
BOOLEAN
MODE
)
AND
field
.
phidType
IN
(
'DREV'
)
AND
document
.
documentType
IN
(
'DREV'
)
LIMIT
1000
)
query
JOIN
`
search_document
`
root
ON
query
.
documentPHID
=
root
.
phid
GROUP
BY
documentPHID
ORDER
BY
documentScore
DESC
LIMIT
0
,
100
;
Event Timeline
epriestley
created this paste.
Jun 9 2017, 10:52 PM
2017-06-09 22:52:29 (UTC+0)
Log In to Comment