Skip to content

Commit

Permalink
implemented new toString method for searching
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Handke committed Jan 14, 2024
1 parent 246ef53 commit d7b65de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/com/example/kickevent/model/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ public Event(long id, String title, Date startDate, Date endDate, String streetN
this.longitude=longitude;
this.latitude=latitude;
}

public String toStringForSearch(){

return this.title + " " + this.owner.getUserName() + " " + this.startDate.toString() + " " + this.endDate.toString() + " " + this.streetName + " " + this.houseNumber + " " + this.postalCode + " " +this.city + " " +this.content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Page<Event> getAll(String sortBy, String search, int size, int page) {
}

public boolean filter(Event event, String search){
return event.toString().toLowerCase().contains(search);
return event.toStringForSearch().toLowerCase().contains(search);
}

public Event createEvent(Event event, Authentication auth) {
Expand Down

0 comments on commit d7b65de

Please sign in to comment.