Compare commits
3 Commits
0107f77570
...
4a673d1894
Author | SHA1 | Date | |
---|---|---|---|
4a673d1894 | |||
0d22da3643 | |||
72128f97a3 |
23
.gitea/workflows/sonarqube.yaml
Normal file
23
.gitea/workflows/sonarqube.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
|
name: SonarQube Scan
|
||||||
|
jobs:
|
||||||
|
sonarqube:
|
||||||
|
name: SonarQube Trigger
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checking out
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# Disabling shallow clone is recommended for improving relevancy of reporting
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: SonarQube Scan
|
||||||
|
uses: kitabisa/sonarqube-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SONARQUBE_HOST }}
|
||||||
|
login: ${{ secrets.SONARQUBE_TOKEN }}
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func SearchQuery(c *fiber.Ctx) error {
|
func SearchQuery(c *fiber.Ctx) error {
|
||||||
query := c.Params("query")
|
query := c.Params("query")
|
||||||
query = strings.TrimSpace(strings.ToLower(query))
|
query = strings.TrimSpace(query)
|
||||||
|
|
||||||
terms, queryType := parseQuery(query)
|
terms, queryType := parseQuery(query)
|
||||||
results := search.Search(terms, queryType, index.Index, index.DocFreq, len(index.Documents))
|
results := search.Search(terms, queryType, index.Index, index.DocFreq, len(index.Documents))
|
||||||
@ -29,12 +29,12 @@ func SearchQuery(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
// parseQuery parses the query to determine query type and terms
|
// parseQuery parses the query to determine query type and terms
|
||||||
func parseQuery(query string) ([]string, string) {
|
func parseQuery(query string) ([]string, string) {
|
||||||
if strings.Contains(query, "AND") {
|
if strings.Contains(strings.ToLower(query), "AND") {
|
||||||
return strings.Split(query, " AND "), "AND"
|
return strings.Split(strings.ToLower(query), " AND "), "AND"
|
||||||
} else if strings.Contains(query, "OR") {
|
} else if strings.Contains(strings.ToLower(query), "OR") {
|
||||||
return strings.Split(query, " OR "), "OR"
|
return strings.Split(strings.ToLower(query), " OR "), "OR"
|
||||||
}
|
}
|
||||||
return strings.Fields(query), "SIMPLE"
|
return strings.Fields(strings.ToLower(query)), "SIMPLE"
|
||||||
}
|
}
|
||||||
|
|
||||||
// phraseMatch checks if all terms appear in the given document in sequence
|
// phraseMatch checks if all terms appear in the given document in sequence
|
||||||
|
Loading…
x
Reference in New Issue
Block a user