PasswordSearch with multiple search strings #86

Closed
GoogleCodeExporter opened this Issue May 23, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@GoogleCodeExporter
Please describe desired steps of proposed new feature/enhancement:

1. We want to have the possibility to search for new passwords with multiple 
search strings. Can we arrive this? The search should match for explenation, 
when the user writes into the search list the two strings "chief" and "root" 
then every passwords should be displayed which contain chief or root or chief 
and root.


What version of the product are you using? On what operating system?

v.1.2.1


Original issue reported on code.google.com by heindl...@googlemail.com on 27 Jun 2013 at 3:47

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter May 23, 2015

Original comment by joshdrum...@gmail.com on 28 Jul 2013 at 11:18

  • Changed state: Accepted
  • Added labels: Milestone-Release1.4

Original comment by joshdrum...@gmail.com on 28 Jul 2013 at 11:18

  • Changed state: Accepted
  • Added labels: Milestone-Release1.4

joshdrummond added a commit that referenced this issue Jul 9, 2015

@mateuszskala

This comment has been minimized.

Show comment
Hide comment
@mateuszskala

mateuszskala Sep 18, 2015

For me it's not working becouse for all searchTerms You add all finded passwords to passwordSet in PasswordServiceImpl.java
I have fixed this by code:

--- PasswordServiceImpl.java (d133399)
+++ Current File
@@ -253,10 +253,17 @@
         else
         {
             Set passwordSet = new HashSet();
+            Boolean firstSearchTerm=true;
             for (String searchTerm : searchTerms)
             {
+                if (firstSearchTerm) {
                 passwordSet.addAll(passwordDAO.findPasswordByFuzzySearch(searchTerm, loggedInUser, activeOnly, tags, tagMatch));
+                firstSearchTerm=false;
             }
+                else{
+                    passwordSet.retainAll(passwordDAO.findPasswordByFuzzySearch(searchTerm, loggedInUser, activeOnly, tags, tagMatch));
+                }
+            }
             passwords.addAll(passwordSet);
         }
         Collections.sort(passwords);

For me it's not working becouse for all searchTerms You add all finded passwords to passwordSet in PasswordServiceImpl.java
I have fixed this by code:

--- PasswordServiceImpl.java (d133399)
+++ Current File
@@ -253,10 +253,17 @@
         else
         {
             Set passwordSet = new HashSet();
+            Boolean firstSearchTerm=true;
             for (String searchTerm : searchTerms)
             {
+                if (firstSearchTerm) {
                 passwordSet.addAll(passwordDAO.findPasswordByFuzzySearch(searchTerm, loggedInUser, activeOnly, tags, tagMatch));
+                firstSearchTerm=false;
             }
+                else{
+                    passwordSet.retainAll(passwordDAO.findPasswordByFuzzySearch(searchTerm, loggedInUser, activeOnly, tags, tagMatch));
+                }
+            }
             passwords.addAll(passwordSet);
         }
         Collections.sort(passwords);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment