Very cool module. I was looking for a module to enable me to search for Drupal users based on user profile criteron and finder on a view of users seems to be the ticket for me.

Question, I want to add many fields from the user profile to my finder form and allow the user to AND them to together to located the users he wants. However, likely only some of the criteron will be used in any given search and the reminder should be ignored in the search. I see that checkboxes have an 'add empty item to top/bottom of list'. Does that mean that field will be ignored in the search?

Also I was haveing trouble getting a test field to be ignored in search as well. Well I entered a value it found all the users in the view with the value. However, when the field was blank, it returned no user records when I was hoping it would return all user records.

Thanks for any help.

CommentFileSizeAuthor
#6 finder-6.x-1.7-views-empty-keyword.patch539 bytesrwd

Comments

danielb’s picture

I see that checkboxes have an 'add empty item to top/bottom of list'. Does that mean that field will be ignored in the search?

Yes. Or if they don't check/select/type anything.

I have heard another user mention that 'anding' stuff together made the empty value NOT ignored. If you find that to be the case, please let me know and I can look into it.

danielb’s picture

Title: How to tell finder to ignore a critereon? » Force ignore of empty values.
Category: support » feature

Yup I can confirm this last statement, it will need to be a feature added specially

webservant316’s picture

Are you saying that this feature needs to be added to the module?
Or that I need to configure my finder view properly the ignore blank fields that are ANDed together?

danielb’s picture

feature, hence why I said feature and changed the category to feature

webservant316’s picture

Any ETA on that?

Your module seems to be the only one available that is smart enough to present an search form based on whatever user profile fields are available through the views modules so that I can search for users ANDing together various profile fields.

rwd’s picture

StatusFileSize
new539 bytes

I encountered what sounds like the same issue with:

  • a Views finder using:
    • conjunction for result combination
    • contains for result matching
  • a text finder element searching on a CCK text field.

The issue appears to be that when the CCK text field is empty, Drupal sets it to NULL in the database, but Finder is running an SQL query like ... WHERE field_foo_bar LIKE '%%' ..., which excludes NULL values for field_foo_bar, and seems like a redundant clause anyway.

Replacing line 382 in finder_views.module with the following code (less the PHP demarcation tags) fixes this specific issue:

if (empty($keyword_array) || ((count($keyword_array) == 1) && (array_pop(array_values($keyword_array)) === ''))) {

This is also attached as a patch for finder_views in 6.x-1.7. Could someone who knows this module better than I advise whether this is likely to have any adverse side-affects, and if not, whether similar logic needs to be applied elsewhere in Finder.

danielb’s picture

Good job richardwdoe, it's good to see someone doing a bit of investigating on their use-case. It's unlikely you'll need to make this change elsewhere (unless CCK features are specifically implemented in to finder_node at some stage, but currently they are not). Thanks for explaining the reasons behind it too.

danielb’s picture

I've also found some code like "if (!empty($keyword_array)) {" in finder_find_query in finder.module which would need to be changed too? Won't affect you if you're only using a Views finder, but I will have to change it there too.
I'm thinking of adding a line before these calls to empty to clean out keywords we consider equivalent to empty. Will need a callback because the default behaviour of array_filter() would remove too much I think.

danielb’s picture

I have added this to my local copy and so far it looks good, I will commit it eventually

danielb’s picture

hmm there seems to be a bug somewhere

danielb’s picture

Status: Active » Fixed

alright I think she's good now

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.