Problem filtering search with custom elements

More
11 years 3 weeks ago #35657 by jackdaniels
Hello,

I tried to setup a field "Type" base on custom list and allow users to filter their search base on this field. However, I think there is maybe a bug in the search, I always got INVALID_QUERY error if I set my filter value as "custom element" or only "--ALL--" if I set it to "use custom query" or "use all values".

[The field "Type"]
Field properties > Content lists > Filter = Yes
Field properties > Advance search view > Filter = Yes
Field specific properties >
Field elements = A::A%%B::B%%C::C
"Filter Options Creation", set Custom retrieval of Filter values to "Use custom elements".
Set Custom element or SQL Query to "A::A%%B::B%%C::C"

In the Search menu option, Search form: advance options > Fields as Filters, add field "type"

Go to the front-end search, click "Advance options".

Expected behavior: A select field with values A, B or C.

Actual behavior: Error "Type: FLEXI_FIELD_INVALID_QUERY"
And the error message is misleading as I do not select "custom query" but "custom elements".

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #35658 by ggppdk
Hello,
FLEXI_FIELD_INVALID_ELEMENTS="There was an error while parsing element values set in field configuration"

There must be some bug, i will fix, also i will add the above missing language string, (it exists in backend, i will to frontend too)

But since your Filter elements are same as Editing Field elements ,
Set "Filter Options Creation", to "Use all filter values" and it should work,


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #35670 by jackdaniels
Note that I really get the error FLEXI_FIELD_INVALID_QUERY even if I have select "Custom elements".

I tried, as you suggested, to set "Use all filter values" but only element I then get in the filter list is "--All--". I edited the query, adding the 15 as field_id without more success.
Code:
SELECT value, value as text FROM #__flexicontent_fields_item_relations WHERE field_id='15' AND value != '' GROUP BY value

And from my #_flexicontent_fields_item_relations, everything is there as supposed:
Code:
field_id,item_id,valueorder,value 15,1,1,A 15,2,1,B 15,3,1,C

Any idea?

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #35672 by ggppdk
Hello,
about the other setting it is a bug about what you described "Use all filter values" not working,
i cannot replicate locally,
the issue must appear to some specific configuration
so please send me a PM with admin Access , plus the field id , plus a link to the frontend view that displays the filter


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #35716 by jackdaniels
Hi,

I cannot give you access to this site, it's a test site on my computer in a corporate network.

However, I jump into the code myself to see where it block. It seem to me that the code look into the advance search index table to get the values instead of using the query I feed him. Now, i hope this will give you some cue on what is wrong.

It started in plgFlexicontent_fieldsSelect->onDisplayFilter
which called
FlexicontentFields::createFilter
which then called
FlexicontentFields::createFilterValuesSearch
At this point, $indexed_elements is set to the good values:
Code:
array(3) { ["A"]=> object(stdClass)#322 (2) { ["value"]=> string(1) "A" ["text"]=> string(1) "A" } ["B"]=> object(stdClass)#320 (2) { ["value"]=> string(1) "B" ["text"]=> string(1) "B" } ["C"]=> object(stdClass)#319 (2) { ["value"]=> string(1) "C" ["text"]=> string(1) "C" } }
However, FlexicontentFields::getFilterValuesSearch is then called, and the query to the db to get the values is changed to:
Code:
SELECT ai.value_id as value, ai.search_index as text , COUNT(*) as found FROM #__flexicontent_advsearch_index AS ai JOIN #__content i ON ai.item_id = i.id JOIN #__flexicontent_items_ext AS ie ON ie.item_id = i.id JOIN #__categories AS c ON c.id = i.catid WHERE 1 AND i.state IN (1,-5) AND c.published = 1 AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= UTC_TIMESTAMP() ) AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= UTC_TIMESTAMP() ) AND c.access IN (1,1) AND i.access IN (1,1) AND ( ie.language LIKE 'en%' OR ie.language="*" ) AND ie.type_id IN ('1','2','3','4') AND ai.field_id=15 GROUP BY ai.search_index, ai.value_id
which return nothing as my advsearch_index is empty (even if I have run the "Re-index Advanced" multiple time)

Now, is it a bug with...
. the advance indexation?
. the filter code?

Thanks

Please Log in or Create an account to join the conversation.

More
11 years 3 weeks ago #35730 by ggppdk
Hello,
the problem is that it uses the configuration parameter wrongly,

so it should be easy to fix, just by modifying an if statement

I have added this in the TODO for v2.0.2

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.282 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline