Search: weblog:entries parameter - Use multiples and OR clause? Search on title?
Posted: 07 May 2008 09:03 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  578
Joined  12-10-2006

With the search weblog:entries parameter, can you use an OR clause with multiple search parameters? For example, if I want to find entries where the custom_field_body contains “rabbit” OR the custom_field_extended_text contains “rabbit”?

Also, using the search weblog:entries parameter, can you search on the {title} field? (I tried but it seems not to work).

(Note to self: I guess I could use sql for searching on title).

TY

Profile
 
 
Posted: 08 May 2008 03:03 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  14079
Joined  05-15-2004

Adam, both of these are current limitations, and would make for a very good FR, I think. Yes, you could use SQL or probably some PHP to achieve that, but it’s not currently implemented. Would you want me to move that to Feature Requests?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 08 May 2008 07:00 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  578
Joined  12-10-2006

Yes please, however, should I create a separate FR for the two (search on {title}, and OR clause)?

Profile
 
 
Posted: 14 May 2008 12:11 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  11
Joined  03-27-2008

adam, were you able to solve this? I have the same exact need, and would love to see the solution.

Profile
 
 
Posted: 14 May 2008 11:14 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  578
Joined  12-10-2006

Hi datapass

I solved it using a query to get the id’s of entries I wanted, and then passed that id to the weblog:entries tag, as below.

I believe it would also be possible to do it with Mark Huots ‘custom fields in exp:weblog tags’ extension.

{exp:query sql="select exp_weblog_titles.entry_id as kids_entry_id from exp_weblog_titles right join exp_weblog_data ON exp_weblog_data.entry_id = exp_weblog_titles.entry_id where exp_weblog_titles.title like '%kids%' OR exp_weblog_data.field_id_16 like '%4 kids%' OR exp_weblog_data.field_id_53 like '%4 kids%'"}
{exp
:weblog:entries weblog="resources" entry_id="{kids_entry_id}" limit="10" paginate="both" cache="yes" orderby="title" sort="asc" disable="categories|category_fields|member_data|trackbacks"}
...
custom fields, etc
...
close tags

Profile
 
 
   
 
 
‹‹ Gallery Search      Display by calendar day ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62721 Total Logged-in Users: 49
Total Topics: 77335 Total Anonymous Users: 19
Total Replies: 417400 Total Guests: 256
Total Posts: 494735    
Members ( View Memberlist )
Newest Members:  jeffccaseyfamilyservicesAledVelindavearioRusspdtrigeminiRRecordbabunomada