@@ -26,63 +26,15 @@ func ValidateGameSearchRequest(dtoBytes []byte) (*schema.GameSearchRequestDto, e
26
26
// buildManticoreMatchString
27
27
// Builds the string to be inserted in the 'match' SQL function.
28
28
func buildManticoreMatchString (dto * schema.GameSearchRequestDto ) (string , error ) {
29
- var matchString string
30
29
query := & dto .Query
31
- genres := dto .Genres
32
- themes := dto .Themes
33
- platforms := dto .Platforms
34
30
35
31
if query == nil {
36
32
return "" , errors .New ("query parameter empty" )
37
33
}
38
34
39
35
parsedQuery := parseQuery (* query )
40
36
41
- // Matches name and alternative_names fields
42
- matchString = fmt .Sprintf ("@(name,alternative_names) %s" , parsedQuery )
43
- var genresMatchString = ""
44
- var themesMatchString = ""
45
- var platformsMatchString = ""
46
-
47
- if genres != nil && len (* genres ) > 0 {
48
- genresMatchString = " @genres_names "
49
- for i , v := range * genres {
50
- if i > 0 {
51
- genresMatchString = fmt .Sprintf ("%s|%s" , genresMatchString , v )
52
- continue
53
- }
54
- genresMatchString = fmt .Sprintf ("%s%s" , genresMatchString , v )
55
- }
56
-
57
- }
58
-
59
- if themes != nil && len (* themes ) > 0 {
60
- themesMatchString = " @themes_names "
61
- for i , v := range * themes {
62
- if i > 0 {
63
- themesMatchString = fmt .Sprintf ("%s|%s" , themesMatchString , v )
64
- continue
65
- }
66
- themesMatchString = fmt .Sprintf ("%s|%s" , themesMatchString , v )
67
- }
68
-
69
- }
70
-
71
- if platforms != nil && len (* platforms ) > 0 {
72
- platformsMatchString = " @(platforms_names,platforms_abbreviations) "
73
- for i , v := range * platforms {
74
- if i > 0 {
75
- platformsMatchString = fmt .Sprintf ("%s|%s" , platformsMatchString , v )
76
- continue
77
- }
78
- platformsMatchString = fmt .Sprintf ("%s%s" , platformsMatchString , v )
79
- }
80
- }
81
-
82
- finalMatchString := fmt .Sprintf ("%s%s%s%s" , matchString , genresMatchString , themesMatchString , platformsMatchString )
83
-
84
- return finalMatchString , nil
85
-
37
+ return parsedQuery , nil
86
38
}
87
39
88
40
func buildManticoreFilterString (dto * schema.GameSearchRequestDto ) (string , error ) {
0 commit comments