Skip to content

Commit 4580fce

Browse files
committed
release notes
1 parent 3d441f7 commit 4580fce

File tree

1 file changed

+160
-0
lines changed

1 file changed

+160
-0
lines changed

ReleaseNotes/1.8.0.md

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
2+
## Elasticsearch plugin for Workflow Core
3+
4+
A search index plugin for Workflow Core backed by Elasticsearch, enabling you to index your workflows and search against the data and state of them.
5+
6+
### Configuration
7+
8+
Use the `.UseElasticsearch` extension method on `IServiceCollection` when building your service provider
9+
10+
```C#
11+
using Nest;
12+
...
13+
services.AddWorkflow(cfg =>
14+
{
15+
...
16+
cfg.UseElasticsearch(new ConnectionSettings(new Uri("http://localhost:9200")), "index_name");
17+
});
18+
```
19+
20+
### Usage
21+
22+
Inject the `ISearchIndex` service into your code and use the `Search` method.
23+
24+
```
25+
Search(string terms, int skip, int take, params SearchFilter[] filters)
26+
```
27+
28+
#### terms
29+
30+
A whitespace separated string of search terms, an empty string will match everything.
31+
This will do a full text search on the following default fields
32+
* Reference
33+
* Description
34+
* Status
35+
* Workflow Definition
36+
37+
In addition you can search data within your own custom data object if it implements `ISearchable`
38+
39+
```c#
40+
using WorkflowCore.Interfaces;
41+
...
42+
public class MyData : ISearchable
43+
{
44+
public string StrValue1 { get; set; }
45+
public string StrValue2 { get; set; }
46+
47+
public IEnumerable<string> GetSearchTokens()
48+
{
49+
return new List<string>()
50+
{
51+
StrValue1,
52+
StrValue2
53+
};
54+
}
55+
}
56+
```
57+
58+
##### Examples
59+
60+
Search all fields for "puppies"
61+
```c#
62+
searchIndex.Search("puppies", 0, 10);
63+
```
64+
65+
#### skip & take
66+
67+
Use `skip` and `take` to page your search results. Where `skip` is the result number to start from and `take` is the page size.
68+
69+
#### filters
70+
71+
You can also supply a list of filters to apply to the search, these can be applied to both the standard fields as well as any field within your custom data objects.
72+
There is no need to implement `ISearchable` on your data object in order to use filters against it.
73+
74+
The following filter types are available
75+
* ScalarFilter
76+
* DateRangeFilter
77+
* NumericRangeFilter
78+
* StatusFilter
79+
80+
These exist in the `WorkflowCore.Models.Search` namespace.
81+
82+
##### Examples
83+
84+
Filtering by reference
85+
```c#
86+
using WorkflowCore.Models.Search;
87+
...
88+
89+
searchIndex.Search("", 0, 10, ScalarFilter.Equals(x => x.Reference, "My Reference"));
90+
```
91+
92+
Filtering by workflows started after a date
93+
```c#
94+
searchIndex.Search("", 0, 10, DateRangeFilter.After(x => x.CreateTime, startDate));
95+
```
96+
97+
Filtering by workflows completed within a period
98+
```c#
99+
searchIndex.Search("", 0, 10, DateRangeFilter.Between(x => x.CompleteTime, startDate, endDate));
100+
```
101+
102+
Filtering by workflows in a state
103+
```c#
104+
searchIndex.Search("", 0, 10, StatusFilter.Equals(WorkflowStatus.Complete));
105+
```
106+
107+
Filtering against your own custom data class
108+
```c#
109+
110+
class MyData
111+
{
112+
public string Value1 { get; set; }
113+
public int Value2 { get; set; }
114+
}
115+
116+
searchIndex.Search("", 0, 10, ScalarFilter.Equals<MyData>(x => x.Value1, "blue moon"));
117+
searchIndex.Search("", 0, 10, NumericRangeFilter.LessThan<MyData>(x => x.Value2, 5))
118+
```
119+
120+
121+
## Action Inputs / Outputs
122+
123+
Added the action Input & Output overloads on the fluent step builder.
124+
125+
```c#
126+
Input(Action<TStepBody, TData> action);
127+
```
128+
129+
This will allow one to manipulate properties on the step before it executes and properties on the data object after it executes, for example
130+
131+
```c#
132+
Input((step, data) => step.Value1 = data.Value1)
133+
```
134+
135+
```c#
136+
.Output((step, data) => data["Value3"] = step.Output)
137+
```
138+
139+
```c#
140+
.Output((step, data) => data.MyCollection.Add(step.Output))
141+
```
142+
143+
## Breaking changes
144+
145+
The existing ability to assign values to entries in dictionaries or dynamic objects on `.Output` was problematic,
146+
since it broke the ability to pass collections on the Output mappings.
147+
148+
149+
```c#
150+
.Output(data => data["Value3"], step => step.Output)
151+
```
152+
153+
This feature has been removed, and it is advised to use the action Output API instead, for example
154+
155+
156+
```c#
157+
.Output((step, data) => data["Value3"] = step.Output)
158+
```
159+
160+
This functionality remains intact for JSON defined workflows.

0 commit comments

Comments
 (0)