File tree Expand file tree Collapse file tree 4 files changed +37
-40
lines changed Expand file tree Collapse file tree 4 files changed +37
-40
lines changed Original file line number Diff line number Diff line change @@ -426,46 +426,6 @@ def valid_reviewers
426
426
# Homepage 4.0 rewrite
427
427
#######################
428
428
429
- class Search < SearchModule ::Search
430
-
431
- class Scope < SearchModule ::Search ::Scope
432
-
433
- def to_hash
434
- case @domain
435
- when :user
436
- followings ( @object )
437
- when :network
438
- network ( @object )
439
- end
440
- end
441
-
442
- def followings ( user )
443
- {
444
- or : [
445
- { terms : { "user.user_id" => [ user . id ] + user . following_users_ids + user . following_team_members_ids } } ,
446
- { terms : { "tags" => user . following_networks_tags } }
447
- ]
448
- }
449
- end
450
-
451
- def network ( tag )
452
- {
453
- terms : { tags : Network . find_by_slug ( Network . slugify ( tag ) ) . try ( &:tags ) || [ tag , Network . unslugify ( tag ) ] . uniq }
454
- }
455
- end
456
- end
457
-
458
- class Query < SearchModule ::Search ::Query
459
- def default_query
460
- "flagged:false"
461
- end
462
- end
463
-
464
- def failover_strategy
465
- { failover : Protip . order ( 'score DESC' ) }
466
- end
467
- end
468
-
469
429
def deindex_search
470
430
Services ::Search ::DeindexProtip . run ( self )
471
431
end
Original file line number Diff line number Diff line change
1
+ class Search < SearchModule ::Search
2
+
3
+ def failover_strategy
4
+ { failover : Protip . order ( 'score DESC' ) }
5
+ end
6
+ end
Original file line number Diff line number Diff line change
1
+ class Query < SearchModule ::Search ::Query
2
+ def default_query
3
+ "flagged:false"
4
+ end
5
+ end
Original file line number Diff line number Diff line change
1
+ class Scope < SearchModule ::Search ::Scope
2
+
3
+ def to_hash
4
+ case @domain
5
+ when :user
6
+ followings ( @object )
7
+ when :network
8
+ network ( @object )
9
+ end
10
+ end
11
+
12
+ def followings ( user )
13
+ {
14
+ or : [
15
+ { terms : { "user.user_id" => [ user . id ] + user . following_users_ids + user . following_team_members_ids } } ,
16
+ { terms : { "tags" => user . following_networks_tags } }
17
+ ]
18
+ }
19
+ end
20
+
21
+ def network ( tag )
22
+ {
23
+ terms : { tags : Network . find_by_slug ( Network . slugify ( tag ) ) . try ( &:tags ) || [ tag , Network . unslugify ( tag ) ] . uniq }
24
+ }
25
+ end
26
+ end
You can’t perform that action at this time.
0 commit comments