I have been struggling for some time now to sort the results of simpleSearch by TV values, as you can with getResources or pdoResources. Using Revo, I have created a directory, the results of which have to be ordered by the number of recommendations that a given business has - recommendations are stored as TVs but i am unable to sortBy these TV values in the search results (unless someone knows how to). Is there another package that someone could recommend that could provide me with this functionality, i.e. allow you to search resources, return results, but then order these results by TV values? I have hit a complete brick wall and this is really important? Many thanks
-
☆ A M B ☆
- 24,524 Posts
One easy way would be to use an otherwise unused resource field, such as description or introtext, rather than a TV.
Thanks for the suggestion Susan, i am using both the description and introtext already - pdoResources and getResources does not (or not that i am aware of ) make use of the [[+extract]] placeholder when wanting a brief summary of a page. I am using [[+extract]] for simpleSearch, but [[+introtext]] for pdoResources since [[+extract]] didn't work. I assumed that the description field had to be used for search engine purposes?
-
☆ A M B ☆
- 24,524 Posts
Just a suggestion. You could even use the Link Attributes field, and make sure to use custom row tpls for Wayfinder that doesn't include the wf.attributes placeholder.
I checked the code for simpleSearch as well as AdvSearch, and neither of them allow for sorting with TV values.
The only other thing I can think of is to wrap SimpleSearch in a snippet (using runSnippet()) that gets the SimpleSearch results as a list of resource IDs, then gets the TV value for each resource to do the sorting and display of the list.