Reflection Field
This is an open discussion with 174 replies, filed under Extensions.
Search
I have noticed a drop in performance when using the reflection field in conjunction with the select box link field. The usage was pretty straightforward:
- I had a section like "cities" with around 50 entries
- another section was named "people" (around 50 entries)
- in the people section there were first-name and last-name fields
- I added a reflection field called "Full Name", reflecting both name fields
- now I set up a select box link field in the cities section to be able to select a single name from the people section
The performance difference:
- using the "Full Name" field, the "cities" datasource needed about 1.0 to 1.5 s to be executed
- using the "Last Name" field, it took about 0.4 to 0.5 s to be executed (the number of database queries being about 50 queries less, which is not a big difference; the total number of queries for the whole page is around 1000)
(I have installed version 1.0.5 for the above tests. As mentioned in a different forum thread, the performance difference seemed to be even higher with version 1.0.4, but at that time testing was not exactly the same!)
Please note that both of the named datasources are rather slow compared to other datasources on the same pages. Every other datasource is executed in less than 0.05 s.
Any ideas?
Hmm...
I've got almost that exact setup. Articles
section with a reference link field (extends select box link and most of the important code comes straight from SBL) for Author
which points to a reflection field in a People
section called Full Name
which concats first and last names. The Article DS execution time is in exactly the same range (0.07 - 0.35) whether I include the Author
field or not. Difference in DB queries is only 10.
I will have to do more testing. Maybe I am hitting some memory limit here? I will try and install the whole website on a different server (like an Amazon EC2 "Large Instance", for example - this cloud computing stuff is really amazing...) and see what happens there.
I have not used the reflection field but I can confirm huge performance differences among different servers.
Just released a new version with a new filter method that adds support for boolean searching, which makes filters like this possible:
search: "match this" not "without this" search: "match this" "or that" search: not "match anything but this"
So you could use this to make a search form that spans multiple fields, and people would know how to use it because it'd behave just like Google.
That's awesome, thanks Rowan.
Can it be use to convert (part of string decamelcased)
feed://picasaweb.google.com/data/feed/base/user/foo/album/FooBar
to an entry title like this
Foo Bar
upon saving , by using functx or in another way? A translate only does one character at a time so you cannot tranlate each letter into space+letter?
I found that using a substring function doesn’t work;
{substring-after (entry/fotoalbum,'authkey=')} {entry/fotoalbum[substring-after(self,'authkey=')]}
Should I do it with php?
Hey Rowan (or anyone else),
I’m using the search:
filter, and do I understand correctly that the output of a reflection field using the search:
filter is intended to be used as a DS filter, such as being filtered by a search string? It pulls from all fields in the entry, correct, or am I totally off? Is there a way to only search some of the fields in the entry?
How do I select the entry’s ID with this field? {entry/@id} is not working for me.
Aye craig, that’s what I’m trying to do. As it’s for a job site, having the Job ID in the section is very helpful when publishing.
Once again this field has saved my bacon. I have a field “Fixtures” with a Date field and a Team select box link (Mens 1st, Mens 2nd, Ladies 1st etc.). I have a hidden Reflection field to concatenate the two together to build a useful “Fixture Reference” value:
{entry/date} ({entry/team/item}}
Resulting in a value like:
2009-09-01 (Men's XV)
Which I then use in a Select Box Link when writing a Match Report. It should also allow me to use this as a handle in URLs to make the match report handle much prettier.
Thank you Rowan!
I echo all the above praise for this extension. Thanks again Rowan! I use this extension all the time. It makes things so much easier. Again, thank you for sharing this extension with us.
Throlkim, did you get the entry ID to work in the end? I just tried it with Reflection Field 1.0.6 and it worked fine.
Nickdunn, I’m working with THrolkim on the same site and we seem to have solved it thanks to your suggestion about reflection Fields latest version.
cheers
moonoo
Any pointers on using reflection as a handle in url in conjunction with sort and order parameters in the datasource?
Can I use the reflection field to actually do some simple calculations? Like:
{entry/field1} + {entry/field2} + {entry/field3} + {entry/field4} + {entry/field5}
Right now when I enter something like that (Except with specific field names) I just literally get the text:
5 + 5 + 5 + 5 + 5
How about:
{entry/field1 + entry/field2 + entry/field3}
Or if that doesn’t work, converting values to numbers explicitly first:
{number(entry/field1) + number(entry/field2) + number(entry/field3)}
Hmmm, I tried both of these and I they didn’t seem to work. Where is this syntax coming from? Is it XSL? Or PHP? Anywhere I can learn more about it?
I’m also trying to find an average here, so at some point I need to divide by 5 as well, but I was trying to keep it more simple first. Can I just put parenthesis around them kinda like this?
{(number(entry/field1) + number(entry/field2) + number(entry/field3))/5}
Create an account or sign in to comment.
A new Extension, “Reflection Field” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.