diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 973f6fa75b4..435b5b85f1e 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -236,7 +236,7 @@ _Details coming soon ..._ | **Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`
e.g., `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 t/friend t/colleague`| | **List** | `list`| | **Edit** | `editdetail [patient ID/detail field/updated patient details]`
e.g.,`editdetail 1/email/johndoe_updated@gmail.com`| -| **Find** | `find KEYWORD [MORE_KEYWORDS]`
e.g., `find James Jake`| +| **search** | `search KEYWORDS]`
e.g., `find James Jake`| | **Delete** | `delete [patientId]`
e.g., `delete 3`| | **Pin** | `pin [patientId]`
e.g., `pin 2`| | **Clear** | `clear`| diff --git a/src/main/java/seedu/address/logic/commands/FindCommand.java b/src/main/java/seedu/address/logic/commands/FindCommand.java index 72b9eddd3a7..7bc13a3f4ce 100644 --- a/src/main/java/seedu/address/logic/commands/FindCommand.java +++ b/src/main/java/seedu/address/logic/commands/FindCommand.java @@ -8,12 +8,13 @@ import seedu.address.model.person.NameContainsKeywordsPredicate; /** - * Finds and lists all persons in address book whose name contains any of the argument keywords. + * Finds and lists all persons in address book whose name contains any of the + * argument keywords. * Keyword matching is case insensitive. */ public class FindCommand extends Command { - public static final String COMMAND_WORD = "find"; + public static final String COMMAND_WORD = "search"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all persons whose names contain any of " + "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n" diff --git a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java b/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java index 62d19be2977..82123a21e8b 100644 --- a/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java +++ b/src/main/java/seedu/address/model/person/NameContainsKeywordsPredicate.java @@ -19,7 +19,15 @@ public NameContainsKeywordsPredicate(List keywords) { @Override public boolean test(Person person) { return keywords.stream() - .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword)); + .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword) || + StringUtil.containsWordIgnoreCase(person.getPhone().value, keyword) || + person.getAllergies().stream() + .anyMatch(hobby -> StringUtil.containsWordIgnoreCase(hobby.allergy, keyword)) + || + StringUtil.containsWordIgnoreCase(person.getGender().gender, keyword) || + StringUtil.containsWordIgnoreCase(person.getBloodType().bloodType, keyword) || + StringUtil.containsWordIgnoreCase(person.getAge().age.toString(), keyword) || + StringUtil.containsWordIgnoreCase(person.getEmail().value, keyword)); } @Override