Compare commits

..

No commits in common. "4a673d189462460d0a6646757c92fc4757370d0f" and "0107f7757086ff1c96192585db605aa73b66c032" have entirely different histories.

2 changed files with 6 additions and 29 deletions

View File

@ -1,23 +0,0 @@
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 }}

View File

@ -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(query) query = strings.TrimSpace(strings.ToLower(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(strings.ToLower(query), "AND") { if strings.Contains(query, "AND") {
return strings.Split(strings.ToLower(query), " AND "), "AND" return strings.Split(query, " AND "), "AND"
} else if strings.Contains(strings.ToLower(query), "OR") { } else if strings.Contains(query, "OR") {
return strings.Split(strings.ToLower(query), " OR "), "OR" return strings.Split(query, " OR "), "OR"
} }
return strings.Fields(strings.ToLower(query)), "SIMPLE" return strings.Fields(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