[OzzModz] Thread Field Filter

[OzzModz] Thread Field Filter 2.0.1 Patch Level 2

No permission to download

Ozzy47

Well-known member
Ozzy47 submitted a new resource:

[OzzModz] Thread Field Filter - Filter threads by custom fields values

Requirements:
XenForo 2.2.0+

Description:

Filter threads by custom fields values

Features:


  • Node-dependent permission to allow filtering thread list by custom field values
  • Option to disable field in forum filters
  • All standard field types is supported (like multiselect, checkboxes and stars)

View attachment 259863

View attachment 259864

View attachment 259865

Read more about this resource...
 
Having trouble with this one. I have a simple check box a custom thread field.



1658787911377.webp

I have a few threads with it enabled:
1658787949013.webp

I see it in the filter:

1658787971594.webp

But it returns no results.
1658788016532.webp

Permissions are good as well: [OzzModz] Thread Field Filter: Can use Yes


Any thoughts? Am I missing something?
 
Is this a good idea to search without an index?

I need an age-field and other integer_fields and think about
  • to add it to xf_thread with index
  • to use custom_fields and your add-on
  • to add a new table made perfect to search for values in for some of my custom_fields.

It will be used only for one subforum and there for maybe 5000 threads; I plan with 10.000 users in a year or two;
the 5000 from the start could be 15.000 threads then, maybe more.

So the question is:
Is there a sense to search in the custom_fields_values when you have 15.000 threads and no index; and this maybe thousand or ten thousands times a day?
 
This works also with rebuild? If not: how can I rebuild the fieldCache?
How can I recreate the fields itself? I am not sure if my fields are ok, after deleting some fields.

Code:
    public function postInstall(array &$stateChanges)
    {
        \XF::runOnce('rebuildFieldCache', function()
        {
            /** @var \XF\Repository\ThreadField $fieldRepo */
            $fieldRepo = $this->app->repository('XF:ThreadField');
            $fieldRepo->rebuildFieldCache();
        });
    }
 
Add-on works nice for

field age, interger.
=> filter age =35


Add-on does not work for checkbox field like this:

field color, checkboxes
1=>red
2=>yellow
3=>green
4=>blue
 
Last edited:
I play around and find this for example:

search-term:
%s:1:"70"%

itis not correct, it must be
%s:1:"7"%
%s:2:"70"%
%s:3:"703"%

for example; s=number of digits/chars
 
Maybe like this?

p/c/forum

Code:
                if (is_array($filterValue) && in_array($definition['field_type'], ['multiselect', 'checkbox']))
                {
                    $whereOr = [];
                    foreach ($filterValue as $value)
                    {
                        $valueLength = strlen($value);
                        $whereOr[] = ['FieldValue.field_value', 'LIKE', $threadFinder->escapeLike('s:'.$valueLength.':"' . $value . '"', '%?%')];
                    }

                    $threadFinder->whereOr($whereOr);
                }
 
You don't want to repair it?
There are more strange things.

I am forced to fill fields in the filter.
If I force myself or users to fill in custom fields, this in one thing,
but to force me or them to use the filters in the same way makes no sense!
 
The custom field filter does not respect the forum restriction for the custom field, so a custom field that is only for one specific forum, shows across all forums.
 
I have uninstalled it, from my point of view this add-on is not finished.
Instead of this, i use an additional search table now.
 
it fails if you have two or more custom field with "select" type
because you will get this conditions
* WHERE field_id='field_id1' AND field_value='field_value1' AND field_id = 'field_id2' AND field_value='field_value2'

profiler says "Impossible WHERE"
 
Back
Top Bottom