SearchEngine.Start Method

Top  Previous  Next

Starts a new search with the current criteria and configuration.

 

[Visual Basic]

 

Public Function Start(ByVal bRunOnNewThread As Boolean) As SearchResultItemList

 

 

Parameters

 

bRunOnNewThread

Flag indicating whether or not the search should be run on a new worker thread (True) or should run on the same thread as the caller (False).

 

 

Return Value

 

A new SearchResultItemList where all found items will be placed.

 

Remarks

 

The search can be run on the same thread as the calling thread or optionally on a new worker thread. If the search is run on the same thread as the caller the calling thread is blocked until the search is completed, no events will be fired during the search, and the search will not be able to be cancelled.

 

If the search is run on a new worker thread then the Start method will return immediately and search progress is reported back as events. Therefore the caller must maintain a reference to the search engine until the search has finished. All events are posted back onto the calling thread, which therefore requires that the calling thread does not block itself through sleeping, busy waiting, or any other such blocking operation, i.e. the calling thread must continue to process its message loop.

 

If the search engine is destructed before the search has finished the search will stop. References to returned objects are still valid.

 

If the search engine is already running a search the method will fail.

 

If any search criteria values are invalid the method will fail.

 

Example

 

[Visual Basic]

 

 engineSearch = New SearchEngineClass

 

 engineSearch.SearchCriteria.FileName         = "*.txt"

 engineSearch.SearchCriteria.ContainingText   = "search"

 engineSearch.SearchCriteria.LookIn           = "c:\search folder"

 

 engineSearch.SearchCriteria.ContentsExprType = ExpressionType.RegExpClassic

 

 engineSearch.SearchConfiguration.SearchThreadCount = 1

 

 Try

         Dim listResult As SearchResultItemList = engineSearch.Start( False )

 Catch err As Exception

         MessageBox.Show(err.Message)

 End Try


Copyright © 2003-2013 Mythicsoft Ltd. All rights reserved.
SDK help file version: 7.0.2