File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,9 +42,7 @@ func main() {
4242 // Create the right type of matcher for this search.
4343 switch site .Type {
4444 case "rss" :
45- matcher = & rss.Search {
46- Site : site ,
47- }
45+ matcher = rss .New (site )
4846
4947 default :
5048 log .Fatalln ("Invalid Type" )
Original file line number Diff line number Diff line change @@ -56,13 +56,19 @@ type (
5656
5757type (
5858 // Implements the Matcher interface.
59- Search struct {
60- Site feeds.Site
59+ Feed struct {
60+ Site * feeds.Site
6161 }
6262)
6363
64+ func New (site feeds.Site ) * Feed {
65+ return & Feed {
66+ Site : & site ,
67+ }
68+ }
69+
6470// Match looks at the document for the specified search term.
65- func (s * Search ) Match (searchTerm string ) ([]find.Result , error ) {
71+ func (s * Feed ) Match (searchTerm string ) ([]find.Result , error ) {
6672 var results []find.Result
6773
6874 log .Printf ("Search Feed Type[%s] Site[%s] For Uri[%s]\n " , s .Site .Type , s .Site .Name , s .Site .Uri )
@@ -107,7 +113,7 @@ func (s *Search) Match(searchTerm string) ([]find.Result, error) {
107113}
108114
109115// retrieve performs a HTTP Get request for the rss feed and unmarshals the results.
110- func (s * Search ) retrieve () (* Document , error ) {
116+ func (s * Feed ) retrieve () (* Document , error ) {
111117 if s .Site .Uri == "" {
112118 return nil , errors .New ("No RSS Feed Uri Provided" )
113119 }
You can’t perform that action at this time.
0 commit comments