GravityKit / GravityView

The best and easiest way to display Gravity Forms entries on your website.
https://www.gravitykit.com/products/gravityview/
245 stars 63 forks source link

Search not using exact-match for select fields #804

Open zackkatz opened 7 years ago

zackkatz commented 7 years ago

Search for urology and in addition to results related to urology we are getting neurology as well. https://secure.helpscout.net/conversation/285290817/0/

The following fields should use exact-match, not "contains":

Update: Select fields work as expected.

soulseekah commented 7 years ago

Possibly related: #821

zackkatz commented 4 years ago

This works for me. Closing until needed.

zackkatz commented 4 years ago

@soulseekah I was able to reproduce with Multi Select.

soulseekah commented 4 years ago

GFQuery does not know how to search within JSON fields it seems.

GF_Query_JSON_Literal is detected but %urology% is not converted to %"urology"% for exact matching. Wrapping the term with " signs produces a lot of \\\\" that don't match what we need when escaped.

I think we need to somehow override these JSON-based multifields in the query and add them as quoted searches.

soulseekah commented 4 years ago

image

Something like this works, but I don't like it at the moment. I want to give it some more thought.

soulseekah commented 4 years ago

We also need figure out how to make the "is" and "contains" operators work for JSON-based multifields.

I'm assuming "is" has to match the selection exactly, so ["one","two"] is NOT "one", but is ["one","two"]. "contains" matches a partial ["one","two"] contains "one".

This is only for select, multiselect, dropdown, radio search controls. Text search is always inexact, unless quoted, I think. Searching for "urology" will only give out "urology" not "neurology".

Still investigating.

soulseekah commented 4 years ago

https://secure.helpscout.net/conversation/1010775016/23477?folderId=408735

soulseekah commented 4 years ago

https://github.com/gravityview/DataTables/issues/122

zackkatz commented 4 years ago

@soulseekah What feedback do you need for this?

soulseekah commented 4 years ago

Quoting from above:

we also need figure out how to make the "is" and "contains" operators work for JSON-based multifields.

I'm assuming "is" has to match the selection exactly, so ["one","two"] is NOT "one", but is ["one","two"]. "contains" matches a partial ["one","two"] contains "one".

This is only for select, multiselect, dropdown, radio search controls. Text search is always inexact, unless quoted, I think. Searching for "urology" will only give out "urology" not "neurology".

zackkatz commented 4 years ago

Yep that sounds good, @soulseekah

soulseekah commented 4 years ago

I'm even thinking that this is a Gravity Forms issue actually. And that it has to be patched inside GF_Query instead.

zackkatz commented 2 years ago

This is still happening.

zackkatz commented 2 years ago

Multiselect inputs are deprecated in Gravity Forms; they show an accessibility notice when using the field…this is less of a problem as it's being used less.

zackkatz commented 2 years ago

Example issues: