aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2017-12-11 00:46:11 -0500
committerTucker Evans <tuckerevans24@gmail.com>2017-12-17 13:20:31 -0500
commitba66f938e978e5472d31606fd46b1081ae6fcbc9 (patch)
treee5027dbfe13432ecc49691276a378a295e946074
parent1be416b14ed0f1071169307df5008a3b644c9973 (diff)
CSC2621/assignments/search: Commiting to change computers.
See next commit for changes
-rw-r--r--search/index.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/search/index.go b/search/index.go
index a0efb6c..43d086b 100644
--- a/search/index.go
+++ b/search/index.go
@@ -28,6 +28,7 @@ type document struct {
}
var r *regexp.Regexp;
+var nonAN *regexp.Regexp;
func newDocument() *document {
return &document{nil, nil};
@@ -97,17 +98,27 @@ func parseDoc(fd *os.File) (*document, error) {
text = r.ReplaceAllString(text, "> <");
t_text = r.ReplaceAllString(text, "> <");
- r_doc = newDocument();
+ text = sanitize.HTML(text);
+ t_text = sanitize.HTML(t_text);
+
+ text = nonAN.ReplaceAllString(text, " ");
+ t_text = nonAN.ReplaceAllString(t_text, " ");
+ r_doc = newDocument();
r_doc.text = strings.Fields(sanitize.HTML(text));
r_doc.title = strings.Fields(sanitize.HTML(t_text));
return r_doc, nil;
}
+func printIndex(w map[string]*wordList) string {
+return "";
+}
+
func init() {
log.SetOutput(os.Stderr);
r, _ = regexp.Compile("><");
+ nonAN, _ = regexp.Compile("[<>!@#&()–[{}]:;,?/*'\"]|( and)|( a)|( an)|( and)|( are)|( as)|( at)|( be)|( by)|( for)|( from)|( has)|( he)|( in)|( is)|( it)|( its)|( of)|( on)|( that)|( the)|( to)|( was)|( were)|( will)|( with)")
}
func main() {