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 (from parent 1:
9b55ca3
)
Support multiple "nick:" terms in search field
author
Christian Weiske
<cweiske@cweiske.de>
Fri, 2 Sep 2016 16:01:58 +0000
(18:01 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Fri, 2 Sep 2016 16:01:58 +0000
(18:01 +0200)
Resolves: #17
src/phinde/Elasticsearch.php
patch
|
blob
|
history
diff --git
a/src/phinde/Elasticsearch.php
b/src/phinde/Elasticsearch.php
index 1732bbb824cbaf8b072379a844f808af06926b72..2887bebe719cd34ec2e892c2fa4b89f640b773d6 100644
(file)
--- a/
src/phinde/Elasticsearch.php
+++ b/
src/phinde/Elasticsearch.php
@@
-52,13
+52,14
@@
class Elasticsearch
public function search($query, $filters, $site, $page, $perPage, $sort)
{
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 (preg_match_all('#nick:([^ ]*)#', $query, $matches)) {
+ foreach ($matches[1] as $authorName) {
+ $query = str_replace(
+ 'nick:' . $authorName,
+ 'author.name:' . $authorName,
+ $query
+ );
+ }
}
$qMust = array();//query parts for the MUST section
}
$qMust = array();//query parts for the MUST section