File tree 2 files changed +8
-21
lines changed
2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -11,32 +11,19 @@ public function searchQuery($options)
11
11
$ options = array_merge (array (
12
12
'blog_uuid ' => null ,
13
13
), $ options );
14
- $ qb = $ this ->createQueryBuilder ();
15
-
16
- $ criterias = array ();
14
+ $ qb = $ this ->createQueryBuilder ('a ' );
17
15
18
16
if ($ options ['blog_id ' ]) {
19
- $ criterias [] = $ qb ->expr ()->descendant ($ options ['blog_id ' ]);
20
- }
21
-
22
- if (count ($ criterias ) == 2 ) {
23
- $ qb ->where (
24
- $ qb ->expr ()->andX ($ criterias [0 ], $ criterias [1 ])
25
- );
26
- } elseif (count ($ criterias ) == 1 ) {
27
- $ qb ->where (current ($ criterias ));
17
+ $ qb ->where ()->descendant ('a. ' . $ options ['blog_id ' ]);
28
18
}
29
19
30
- $ qb ->orderBy ('date ' , 'DESC ' );
31
- $ q = $ qb ->getQuery ();
32
-
33
- return $ q ;
20
+ $ qb ->orderBy ()->descending ()->field ('a.date ' );
21
+ return $ qb ->getQuery ();
34
22
}
35
23
36
24
public function search ($ options )
37
25
{
38
26
$ q = $ this ->searchQuery ($ options );
39
- $ res = $ q ->execute ();
40
- return $ res ;
27
+ return $ q ->execute ();
41
28
}
42
29
}
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ class PHPCRStringStrategy implements StrategyInterface
16
16
*/
17
17
public function getWeightedTags ($ blogId )
18
18
{
19
- $ qb = $ this ->postRep ->createQueryBuilder ();
19
+ $ qb = $ this ->postRep ->createQueryBuilder (' a ' );
20
20
$ qb ->select ('tags ' );
21
- $ qb ->descendant ($ blogId ); // select only children of given blog
21
+ $ qb ->where ()-> descendant (' a ' , $ blogId ); // select only children of given blog
22
22
$ q = $ qb ->getQuery ();
23
23
$ res = $ q ->getPhpcrNodeResult ();
24
24
$ rows = $ res ->getRows ();
@@ -44,6 +44,6 @@ public function getWeightedTags($blogId)
44
44
$ tag ['weight ' ] = $ tag ['count ' ] / $ max ;
45
45
}
46
46
47
- return $ wTags ;
47
+ return $ weightedTags ;
48
48
}
49
49
}
You can’t perform that action at this time.
0 commit comments