Forums / Developer / attribute_filter on xmltext and text fields?

attribute_filter on xmltext and text fields?

Author Message

Gabriel Ambuehl

Friday 07 October 2005 5:17:15 am

Is there a way to do a fetch like

attribute_filter(textfield, like, "some keyword")

on text fields and xml text fields? Or do I need to write my own filter?

Thanks anyway!

Visit http://triligon.org

Paul Borgermans

Friday 07 October 2005 6:43:30 am

Yes,

My patch landed in the core since 3.6:

http://pubsvn.ez.no/nextgen/stable/3.6/doc/features/3.6/content_tree_enhanced_filters.txt

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Hans Melis

Friday 07 October 2005 8:33:32 am

The 'like' operator indeed exists since 3.6, but the eztext and ezxmltext datatypes unfortunately don't support attribute filtering.

There wouldn't be a problem to implement it if the content of the datatypes contains less than 256 characters. In case there are more characters, some truncating is needed which is kind of pointless for those datatypes (the database field for string attribute filtering is a VARCHAR(255) in mysql and pgsql).

I think it's possible to implement what you want using extended attribute filtering. Just do an sql LIKE operation on the data_text field for the datatypes.

Hans
http://blog.hansmelis.be

Gabriel Ambuehl

Friday 07 October 2005 8:45:13 am

Yes, it works like a charm for text line but I was wondering about the two "long string" types, mostly.

I'll likely write an extended attribute filter some time (or maybe see if I can hack the core and submit it as patch), but for the time being, I'll likely be able to get away without it ;)

Visit http://triligon.org

Paul Borgermans

Friday 07 October 2005 11:20:12 am

For longer text fields, why not use the search as a fetch function? The like operator may slow things a lot in this case?

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Gabriel Ambuehl

Friday 07 October 2005 11:55:14 am

I was thinking about that. And also just using a custom join on the search table. Haven't made up my mind yet ;)

Visit http://triligon.org