Forums Forums Search & Filter Pro Exclude Blank Items From Results

Tagged: 

Viewing 10 posts - 1 through 10 (of 14 total)
  • Anonymous
    #253238

    I have a numeric “inches” range field on my form that ranges from 0 – 50.

    Some of the records in my database do not have an “inches” value i.e. they are blank.

    My client doesn’t want “blanks” getting included in the search result when they enter a filter of 0-19 but they also don’t want them excluded when the default 0 – 50 filter is enabled.

    I thought one solution might be to force the filter to have a starting value of 1 but that obviously doesn’t work because the records with a blank “inches” value will never appear.

    I’m at a dead end and would appreciate any guidance.

    Anonymous
    #253250

    I’ve been thinking about this a bit more and I think the issue is that your plugin includes ALL number range filters in the URL query string even if they have not been touched.

    If you only passed the filters that have been touched/modified AND cleared them all out of the URL string when “Reset” is pressed then I think I’d get my expected behavior.

    Is there any workarounds you can think of here?

    Anonymous
    #253251

    I was able to setup the desired experience with a competitor product. I’d prefer not to use that product but I’m going to paste the experience here because it illustrates what I’m trying to achieve

    https://granderwatch-4b609e.ingress-alpha.easywp.com/?elementor_library=grander-archive

    Post 1 has a tail value of 19 on it
    Post 2 has a tail value of N/A

    If the filter is adjusted at all, Post 2 is removed from the results.

    If the filter is “reset” both Post 1 and Post 2 are returned even though the minimum value on the filter is 1 and even though Post 2 has a tail value of N/A.

    This is the desired experience I’d like to create with Search & Filter Pro.

    Trevor
    #253286

    The problem for us is that, N/A is not in the database. At all. There is no entry for that field for that Post, so, when a range is sent to as a filter, all such posts disappear. It is not like a spreadsheet with empty cells. The cells do not exist.

    With no filters applied, all posts will show. There is, at this time, only one solution, and that is not to use a range field, but instead offer the user a list of ‘ranges’ to choose from, like this:

    N/A
    0-5
    6-10
    11-15

    This might require you to have a second custom field for ‘tail value’ with those text strings in. You can make an autosave function in your child theme functions.php that would autopopulate one field from the other.

    Anonymous
    #253775

    I have the same problem. I have 100 cars.
    90 cars have a given installment value. 10 cars no.
    You can search in installments in the search engine. As a result, the search engine always shows 90 cars, and 10 will never appear after pressing “search”.

    Anonymous
    #253777

    Is it possible for the blank fields with a range of values in the search engine to be omitted from the search results? Or when they are equal to min and max so that they are also omitted?

    Trevor
    #253782

    Krzysztof

    My reply above in this post:

    https://support.searchandfilter.com/forums/topic/exclude-blank-items-from-results/#post-253286

    Is what you face. If you use a range field, as soon as you make a search, any car that does not have a value for that field will disappear. If you do not wish this to happen, you would need to create a new field with pre-defined ranges for the user to choose from, which are actually text strings/terms/tags.

    Anonymous
    #254238

    Ok. So i can’t use this field. Do you have sample code for autopopulate?

    Trevor
    #254253

    This post shows an example of a year field being auto populated:

    https://support.searchandfilter.com/forums/topic/datefilter/page/3/#post-238869

    Anonymous
    #255166

    The example you described is to create an additional field in cars or in search?

Viewing 10 posts - 1 through 10 (of 14 total)