Using Wildcard Search Web Part to search for recently modified files

Posted Wednesday, September 17, 2008 8:39 AM by CoreyRoth

You may have a case where you want to search for files that were recently modified.  Sure, you can use a CAML query to do this, but what if you want to look for recently changed files across multiple content sources?  Sure, you can write your own Full Text SQL Query and bind it in a web part, but there is an easier way.  The new FixedFullTextSqlQuery property in Release 2 of the Wildcard Search Web Part makes this really simple.  You just need the right query. 

Date functions in Enterprise Search SQL are similar but the syntax is a little different.  First you'll need to get the current date.  The GETGMTDATE function is what you need to get the current date.  Next you just need to use DATEADD to subtract the number of days, months, etc, that you need for your fixed query.  In this case, I'll subtract 7 days by specifying DAY and -7.  You can also specify MONTH, YEAR, HOUR, etc as well.  The last modified date is stored in a managed property called Write (took me a while to figure that one out).  That will make your condition look something like this.


Then, all you need to do is form your SELECT statement.  You can't use SELECT *, so you need to specify all of your columns individually.  The easiest way to get this column list is to look at the Select Columns property on your control.  My example below lists most of them.  When you are all done, this is what your query would look like.

SELECT Rank, Title, Path, Author, Write, WorkId, Size, Description, SiteName, CollapsingStatus, ContentClass, IsDocument, HitHighlightedSummary, HitHighlightedProperties, FROM Scope() WHERE Write > DATEADD(DAY, -7, GETGMTDATE())

This will query the entire index for documents modified in the last 7 days.  You may want to filter it down to a specific scope by using an additional condition in your WHERE clause.


# re: Using Wildcard Search Web Part to search for recently modified files

Wednesday, September 17, 2008 10:37 AM by mosleh

folks, if you havent use ontalica that uses sharepoint, you may want to give it a try. we re giving out our version of wildcard. we can give you a trial version wich is good for 30 days.

in a nutshell, how you can improve the search by adding our product in sharepoint as follows:

Ontolica Search gives you consistent search across SharePoint 2007 and WSS sites.

It improves the users' search experience, leading them to the information they are looking for, by improving all basic search features in SharePoint 2007.

Ontolica Search provides you with a perfect overview of your metadata, and allows you to configure the search interface, enabling end-users to categorize and adapt search to individual needs.

By adding Ontolica Search, IT-professionals are saved months of reprogramming SharePoint 2007 to the specific needs of organizations using SharePoint.

Ontolica Search is extremely flexible and customizable, and has an abundance of clever and indispensable features.

See the complete

# re: Using Wildcard Search Web Part to search for recently modified files

Wednesday, September 17, 2008 4:40 PM by KyleKelin


I don't know much about blog etiquette but I would think advertising a similiar search product on the author's blog would be crossing the line. Especially when Corey is giving his product away for free to better the SharePoint community.

# Links (9/18/2008) « Steve Pietrek - Everything SharePoint

Thursday, September 18, 2008 7:56 PM by Links (9/18/2008) « Steve Pietrek - Everything SharePoint

Pingback from  Links (9/18/2008) « Steve Pietrek - Everything SharePoint

# SharePoint News 19/9

Friday, September 19, 2008 12:22 PM by Mirrored Blogs

Nuevamente les traigo mas información para SharePoint! Developers : 1 - Using Wildcard Search Web

Leave a Comment