Getting context around search string in results fr

2019-05-07 03:15发布

问题:

I have code in my project that uses Windows Search to look through file contents for a string I provide.

SELECT System.ItemName, System.ItemType, System.Search.Rank FROM SYSTEMINDEX 
WHERE SCOPE='file:C:/NiftyFolder' 
AND CONTAINS(System.Search.Contents,'"SEARCH STRING"')

I get the proper search results but I'd like to go a step further and get the context around my search string. I'm showing the search results on a webpage and ideally, I'd like something similar to what you get in Windows when you have the proper iFilters installed.

I've got the file type, path, and name but is there a System.??? that will get the text that's circled in orange in the image above?

Update: After more searching, it looks like it's not available.

http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/1879e40f-bbf3-4365-b8f9-e0190ef437b0

http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/ddd38a26-30a8-48f5-b053-dcee01094e2b

Windows Desktop Search not returning QueryFocusedSummary

The closest thing is System.Search.AutoSummary but it just returns the first 1000 or so text characters from the file.