Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Smart Search View modes: 
User avatar
Member
Member
TG - 1/28/2013 4:39:17 PM
   
Smart Search
I am needing to search my events document type using a date range and return all events that occur during that range.

My events have a start date and end date. Is there a way to search for the start date, end date, and any dates in between those two dates?

I know you can do - startdate:[201301071010 TO 201301102359] but this just looks in the startdate field and if I have an event that starts on 1/7/2013 and ends on 1/11/2013, but my user searches the range 1/8/2013 to 1/10/2013, then this event will not show up in the results.

I want all events that are happening during the range entered by the user to be displayed, even if the start date has passed.

Any suggestions?

User avatar
Member
Member
TG - 1/29/2013 7:56:21 AM
   
RE:Smart Search
On my document type I collect the start and end date of the event and then use a custom form control to populate the start date, the end date and all dates in between into a hidden text box field. I made this field searchable. This allows me to look at all possible dates for a given event.

I take the start date and end date chosen by the user and put the start date, end date and dates in between, into a text box field on my custom web part. This gives me all the dates in the users range in a text box separated by a space. I then use this field as a filter to narrow down my event list to the dates chosen.

The issue is that when I try and search/filter using this field with the date range the user selects, if the range is greater than 1000 days it returns "No data found". I believe this is because I am searching for all 1000 dates, all of which are stored in a single hidden text box. I know this is probably not the best way to accomplish this and I just need a bit of a nudge in the right direction.

User avatar
Member
Member
TG - 1/29/2013 10:16:34 AM
   
RE:Smart Search
I finally figured this out. I was way over-thinking the issue.

I used my custom web part to place the "fromdate" and the "todate" in the URL query string. I then used the following Values in my filter to use the query string variables to perform my event filter.
%IfEmpty(QueryString["fromdate"],"","dates;"+QueryString["fromdate"]+";Dates")#%}
{%IfEmpty(QueryString["todate"],"","dates;"+QueryString["todate"]+";Dates")%}

I also set the Filter Clause to "Must" to make the above state an "OR" so all checks would be used.

This made it possible to search my startdate and enddate as well as search my custom form control "dates" that housed all of my dates for a given event. Now I can return any event that contains any date in the range chosen by the user.

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 1/30/2013 1:38:01 AM
   
RE:Smart Search
Hello,

thank you for sharing your solution with others. We really appreciate it.

Best regards,
Richard Sustek