Orc.Search
Name | Badge |
---|---|
Chat | |
Downloads | |
Stable version | |
Unstable version |
Easily add searching to any application.
Uses Lucene in the background.
Search Syntax: http://www.lucenetutorial.com/lucene-query-syntax.html
Nuget Packages
- Orc.Search => The core of
Orc.Search
. Contains the main services, base classes and attributes. - Orc.Search.Xaml => Contains basic Ui elements, which can be used to add seach functionality to your application.
Features
- Uses Lucene for the indexing and searching
- Properties, which need to be indexed should be decorated with the
SearchablePropertyAttribute
- To support highlighting you should create your own search highlight provider, by inheriting from
SearchHighlightProviderBase
- You can redefine the implementation of
ISearchService
, by creating your own class which will inheritSearchServiceBase
and register it using[Catel.IoC.IServiceLocator](http://www.nudoq.org/#!/Packages/Catel.Core/Catel.Core/IServiceLocator)
- Supports asynchronos searching (uses
ISearchServiceExtensions
)
Quick start
- Create a POCO class to use in your search and decorate the properties with
SearchablePropertyAttribute
public class Person
{
[SearchableProperty(SearchName = "firstname")]
public string FirstName { get; set; }
[SearchableProperty(SearchName = "lastname")]
public string LastName { get; set; }
public int Age { get; set; }
}
- Fill the
ISearchService
with the appropriate “Person” data using theAddObjects()
method. The objects must be wrapped inside anISearchable
implementation, for example theReflectionSearchable
:
searchService.AddObjects(persons.Select(x => new ReflectionSearchable(x));
- Use the
Search()
method for getting search results. Use thestring filter
as an argument. Note that you will receive theISearchable
instances that have a hit. This means you can still retrieve the metadata after a search has been completed.
In order to use the asynchronous version of search. Just use the Async suffix method names (i.e. SearchAsync()
, AddObjectsAsync()
, RemoveObjectsAsync()
)
Contributions
We would like to thank the following contributors:
Want to contribute to the documentation? We have a guide for that!
Questions
Have a question about Catel or WildGums controls? Use StackOverflow with the Catel tag!