fix: Updated AddDocToIndex function to ignore additional special characters in scanner.Text()
This commit is contained in:
parent
4a673d1894
commit
cf95ee2acb
@ -87,7 +87,7 @@ func AddDocToIndex(url string, content string) {
|
|||||||
scanner.Split(bufio.ScanWords)
|
scanner.Split(bufio.ScanWords)
|
||||||
|
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
word := strings.ToLower(strings.Trim(scanner.Text(), ",.!?"))
|
word := strings.ToLower(strings.Trim(scanner.Text(), ",.!?&<>;:=§$%{}[]()|"))
|
||||||
|
|
||||||
if Index[word] == nil {
|
if Index[word] == nil {
|
||||||
Index[word] = make(map[string]int)
|
Index[word] = make(map[string]int)
|
||||||
@ -100,7 +100,7 @@ func AddDocToIndex(url string, content string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIndex("default")
|
go updateIndex("default")
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeStructToFile(filename string, data interface{}) error {
|
func writeStructToFile(filename string, data interface{}) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user