Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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,
                SPSiteSubscriptionIdentifier.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.

--Praveen

share|improve this question
    
Any help on this? Does KeywordQuery support Filename:"Test%" or Filename:"Test*"? –  Praveen Apr 9 '12 at 6:28
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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