I've been using FullTextSQLQuery or Search Web Service in my custom search solution till today. Wanted to explore KeywordQuery but usage of 'LastModifiedTime' in query doesn't return search results.

code snippet:

SPServiceContext context = SPServiceContext.GetContext(SPServiceApplicationProxyGroup.Default,

SearchServiceApplicationProxy ssap = context.GetDefaultProxy(typeof(SearchServiceApplicationProxy))
                    as SearchServiceApplicationProxy;
using (KeywordQuery query = new KeywordQuery(ssap))
query.QueryText = "IsDocument:1 Filename:\"Test*\" Path:\"http://sp2010vm/Shared Documents/*\" (LastModifiedTime > '2011/04/25 05:00:00 PM' AND LastModifiedTime <= '2011/04/26 06:00:00 PM')";

Removing LastModifiedTime check works perfectly. How to include LastModifiedTime criteria? Also,is there a way to simulate Filename LIKE 'Test%' behavior using KeywordQuery? Neither Filename:"Test%" nor Filename:"Test*" works this way.


  • Any help on this? Does KeywordQuery support Filename:"Test%" or Filename:"Test*"?
    – Praveen
    Apr 9, 2012 at 6:28

1 Answer 1


Try changing query to:

query.QueryText = "IsDocument:1 Filename:\"Test*\" Path:\"http://sp2010vm/Shared Documents/*\" (LastModifiedTime:\"2011-04-25..2011-04-26\")"; 

You cannot filter on time in SharePoint keyword queries. It is ignored (per design i guess)

For completeness: You can also choose to use the "internal" property write: instead of LastModifiedTime

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.