locked
Filter by URL date range RRS feed

  • Question

  • Hi,

    Is there any way to define a search url which includes a date range at the moment for example .. &r=write>"01/01/2012" will give us the correct results for a single date but can we somehow define a range by using more than and less than toegther?

     

    Many thanks

    Wednesday, January 11, 2012 1:07 PM

Answers

  • Nope, what I showed you was Keyword query syntax so it only uses the k=.

    So if you're creating a hardcoded link it would be href="http://myserver/mysite/mysearchpage.aspx?&s=scope&k=ContentClass:STS_ListItem_Announcement (Write>"01/01/2012" AND Write<"01/05/2012")"

    However if you're pasting it into your browser, you'll need to encode the / in the querystring with %2F

    e.g.:- mysearchpage.aspx?s=scope&k=ContentClass%3ASTS_ListItem_Announcement (write>"01%2F01%2F2012" AND write<"01%2F05%2F2012")

    Best bet is to open your normal search page and type the search keywords in directly, then look at the URL it creates.

    ContentClass:STS_ListItem_Announcement (Write>"01/01/2012" AND Write<"01/05/2012")

    Note, I'm using the ContentClass to search for announcement as I've found this is by far the most reliable method.

    Paul.


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and prevents the same questions being asked multiple times.
    Thursday, January 12, 2012 1:23 PM

All replies

  • Yes you can use the same property twice, you just need to bracket it and use an AND. E.g. ContentClass:STS_ListItem_Announcement (Write>"01/01/2012" AND Write<"01/05/2012") in the search box would show all announcements written between the 1st and 5th of January. Hope this helps Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and prevents the same questions being asked multiple times.
    Wednesday, January 11, 2012 1:20 PM
  • Thanks, im sure that is the correct awnser I just cant get it to work, do I have to still use the r= parameter in the url if I am wrapping the values in brackets? so for example I have:

    http://myserver/mysite/mysearchpage.aspx?&s=scope&k=Announcement&r=(Write>"01/01/2012" AND Write<"01/05/2012")

    Many Thanks,

    Anthony

    Wednesday, January 11, 2012 5:39 PM
  • Nope, what I showed you was Keyword query syntax so it only uses the k=.

    So if you're creating a hardcoded link it would be href="http://myserver/mysite/mysearchpage.aspx?&s=scope&k=ContentClass:STS_ListItem_Announcement (Write>"01/01/2012" AND Write<"01/05/2012")"

    However if you're pasting it into your browser, you'll need to encode the / in the querystring with %2F

    e.g.:- mysearchpage.aspx?s=scope&k=ContentClass%3ASTS_ListItem_Announcement (write>"01%2F01%2F2012" AND write<"01%2F05%2F2012")

    Best bet is to open your normal search page and type the search keywords in directly, then look at the URL it creates.

    ContentClass:STS_ListItem_Announcement (Write>"01/01/2012" AND Write<"01/05/2012")

    Note, I'm using the ContentClass to search for announcement as I've found this is by far the most reliable method.

    Paul.


    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and prevents the same questions being asked multiple times.
    Thursday, January 12, 2012 1:23 PM