git.cweiske.de
/
phinde.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
686f1ce
)
Support "nick:cweiske" search syntax as alias for "author.name"
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 30 Aug 2016 05:36:34 +0000
(07:36 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 30 Aug 2016 05:36:34 +0000
(07:36 +0200)
Resolves: #3
src/phinde/Elasticsearch.php
patch
|
blob
|
history
diff --git
a/src/phinde/Elasticsearch.php
b/src/phinde/Elasticsearch.php
index 310b63bd1538009083e5287cfd0a23dd0f99c5ad..96a769bc18319386eeec8ceef6003980f80220df 100644
(file)
--- a/
src/phinde/Elasticsearch.php
+++ b/
src/phinde/Elasticsearch.php
@@
-70,6
+70,15
@@
class Elasticsearch
public function search($query, $filters, $site, $page, $perPage, $sort)
{
+ if (preg_match('#nick:([^ ]*)#', $query, $matches)) {
+ $authorName = $matches[1];
+ $query = str_replace(
+ 'nick:' . $authorName,
+ 'author.name:' . $authorName,
+ $query
+ );
+ }
+
if ($sort == 'date') {
$sortCfg = array('modate' => array('order' => 'desc'));
} else {