Skip to content

Commit 7cb89ec

Browse files
Merge pull request #64 from textkernel/match-v2
Add Search & Match V2 Functionality
2 parents e468b96 + 1c366a9 commit 7cb89ec

File tree

491 files changed

+5442
-154914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

491 files changed

+5442
-154914
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5,95 +5,16 @@ on:
55
branches:
66
- master
77

8-
jobs:
9-
get_docfx_status: #check if the last commit was an auto-generation of docfx by this CI workflow
10-
name: get-docfx-status
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v2
14-
with:
15-
fetch-depth: 10 # important for use of HEAD^2
16-
# find the last commit message on the source branch
17-
- name: Get last commit message
18-
shell: bash
19-
run: echo "##[set-output name=commitMsg;]$(git log --format=%B -n 1 HEAD^2)"
20-
id: extract_message
21-
outputs:
22-
# create an output that tells the following jobs whether or not we need to generate docfx
23-
generate_docfx: ${{ steps.extract_message.outputs.commitMsg != '--- auto-generation of docfx documentation ---' }}
24-
25-
generate-docfx:
26-
needs: get_docfx_status
27-
# only run this if we have not generated docfx in last commit
28-
if: ${{ needs.get_docfx_status.outputs.generate_docfx == 'true' }}
29-
runs-on: windows-latest
30-
steps:
31-
- uses: actions/checkout@v2
32-
- name: Setup .NET Core
33-
uses: actions/setup-dotnet@v4
34-
with:
35-
dotnet-version: 3.1.x
36-
- name: Setup DocFX
37-
uses: crazy-max/ghaction-chocolatey@v1
38-
with:
39-
args: install docfx
40-
- name: Install dependencies
41-
run: dotnet restore
42-
working-directory: src/Textkernel.Tx.SDK
43-
# generate the DocFX docs into the /docfx/_site folder
44-
- name: DocFX Build
45-
working-directory: docfx
46-
run: docfx docfx.json
47-
continue-on-error: false
48-
# upload the generated docs into an artifact that can be used by the job below
49-
- name: Upload Artifacts
50-
uses: actions/upload-artifact@v4
51-
with:
52-
name: site-${{ matrix.runs-on }}
53-
path: docfx/_site
54-
55-
#the github-pages-deploy-action needs to run on ubuntu, so use upload/download artifact to generate on windows and publish on ubuntu
56-
publish-docfx:
57-
needs: [get_docfx_status, generate-docfx]
58-
runs-on: ubuntu-latest
59-
if: ${{ needs.get_docfx_status.outputs.generate_docfx == 'true' }}
60-
steps:
61-
- uses: actions/checkout@v2 #checkout so we can do the git commit
62-
# extract the PR source branch name from the env variable where we can use it later
63-
- name: Extract branch name
64-
shell: bash
65-
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF#refs/heads/})"
66-
id: extract_branch
67-
# download the site files as an artifact
68-
- name: Download Artifacts
69-
uses: actions/download-artifact@v4
70-
with:
71-
path: site
72-
pattern: site-*
73-
# publish the generated docs into the /docs folder on a new commit in this branch
74-
- name: Publish DocFX to GitHub Pages
75-
uses: JamesIves/github-pages-deploy-action@4.1.4
76-
with:
77-
branch: ${{ steps.extract_branch.outputs.branch }}
78-
folder: site #use the downloaded artifact path here
79-
target-folder: docs
80-
git-config-name: Continuous Integration
81-
git-config-email: devs@sovren.com
82-
commit-message: --- auto-generation of docfx documentation ---
83-
token: ${{ secrets.DOCFX_CI_TOKEN }}
84-
8+
jobs:
859
build:
86-
needs: get_docfx_status
87-
# only run this if we have already generated docfx in last commit
88-
if: ${{ needs.get_docfx_status.outputs.generate_docfx == 'false' }}
8910
runs-on: ubuntu-latest
9011
steps:
9112
- uses: actions/checkout@v2
9213
- name: Setup .NET Core
9314
uses: actions/setup-dotnet@v4
9415
with:
9516
dotnet-version: |
96-
7.0.x
17+
8.0.x
9718
2.0.x
9819
- name: Install dependencies
9920
run: dotnet restore
@@ -103,16 +24,14 @@ jobs:
10324
working-directory: src/Textkernel.Tx.SDK
10425

10526
unit-tests:
106-
needs: get_docfx_status
10727
runs-on: ubuntu-latest
10828
# only run this if we have already generated docfx in last commit
109-
if: ${{ needs.get_docfx_status.outputs.generate_docfx == 'false' }}
11029
steps:
11130
- uses: actions/checkout@v2
11231
- name: Setup .NET Core
11332
uses: actions/setup-dotnet@v4
11433
with:
115-
dotnet-version: 7.0.x
34+
dotnet-version: 8.0.x
11635
- name: Create credentials file
11736
run: 'echo "$CREDENTIALS_FILE" > src/Textkernel.Tx.SDK.Tests/credentials.json'
11837
shell: bash

.github/workflows/docs-publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: docs-publish
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
workflow_dispatch: #add this option in case of a failure and we need to re-run
8+
9+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
10+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
# only run this if we have not generated docfx in last commit
18+
if: github.event.pull_request.merged == true
19+
runs-on: windows-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Setup .NET Core
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: 3.1.x
26+
- name: Setup DocFX
27+
uses: crazy-max/ghaction-chocolatey@v1
28+
with:
29+
args: install docfx
30+
- name: Install dependencies
31+
run: dotnet restore
32+
working-directory: src/Textkernel.Tx.SDK
33+
# generate the DocFX docs into the /docfx/_site folder
34+
- name: DocFX Build
35+
working-directory: docfx
36+
run: docfx docfx.json
37+
continue-on-error: false
38+
# upload the generated docs into an artifact that can be used by the job below
39+
- name: Upload Artifacts
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: docfx/_site
43+
deploy:
44+
needs: build
45+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
46+
permissions:
47+
pages: write # to deploy to Pages
48+
id-token: write # to verify the deployment originates from an appropriate source
49+
50+
# Deploy to the github-pages environment
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
54+
runs-on: ubuntu-latest
55+
if: github.event.pull_request.merged == true
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v4

.github/workflows/nuget-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/setup-dotnet@v4
1717
with:
1818
dotnet-version: |
19-
7.0.x
19+
8.0.x
2020
2.0.x
2121
- name: Install dependencies
2222
run: dotnet restore

README.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,40 +73,37 @@ ITxClient client = serviceProvider.GetRequiredService<ITxClient>();
7373

7474
For self-hosted customers, you can create a `DataCenter` object with your custom URL using the constructor provided on that class.
7575

76+
### Using the various `TxClient` services
77+
The `TxClient` has the following services available, exposed as properties on the `ITxClient` interface:
78+
- Parser
79+
- Geocoder
80+
- Formatter
81+
- SkillsIntelligence
82+
- SearchMatchV1
83+
- SearchMatchV2
84+
85+
Each service exposes certain API functionality via its methods. For example, to parse a resume you would do something like:
86+
```c#
87+
ITxClient client;//created or injected however
88+
var parseResponse = await client.Parser.ParseResume(...);
89+
```
90+
91+
For the complete list of methods on each service and their method signatures, check out our [DocFX-generated docs][docfx-txclient].
92+
7693
### Handling errors and the `TxException`
7794
Every call to any of the methods in the `TxClient` should be wrapped in a `try/catch` block. Any 4xx/5xx level errors will cause a `TxException` to be thrown. Sometimes these are a normal and expected part of the Tx API. For example, if you have a website where users upload resumes, sometimes a user will upload a scanned image as their resume. Textkernel does not process these, and will return a `422 Unprocessable Entity` response which will throw a `TxException`. You should handle any `TxException` in a way that makes sense in your application.
7895

7996
Additionally, there are `TxUsableResumeException` and `TxUsableJobException` which are thrown when some error/issue occurs in the API, but the response still contains a usable resume/job. For example, if you are geocoding while parsing and there is a geocoding error (which happens after parsing is done), the `ParsedResume` might still be usable in your application.
8097

81-
### How to create a Matching UI session
82-
You may be wondering, "where are the Matching UI endpoints/methods?". We have made the difference between a normal API call (such as `Search`) and its equivalent Matching UI call extremely trivial. See the following example:
83-
84-
```c#
85-
TxClient client = new TxClient(httpClient, new TxClientSettings
86-
{
87-
AccountId = "12345678",
88-
ServiceKey = "abcdefghijklmnopqrstuvwxyz",
89-
DataCenter = DataCenter.US
90-
});
91-
List<string> indexesToSearch = ...;
92-
FilterCriteria searchQuery = ...;
93-
94-
SearchResponse searchResponse = await client.Search(indexesToSearch, searchQuery);
95-
```
96-
To generate a Matching UI session with the above Search query, you simply need to call the `UI(...)` extension method on the `TxClient` object, pass in any UI settings, and then make the same call as above:
97-
```c#
98-
MatchUISettings uiSettings = ...;
99-
GenerateUIResponse uiResponse = await client.UI(uiSettings).Search(indexesToSearch, searchQuery);
100-
```
101-
For every relevant method in the `TxClient`, you can create a Matching UI session for that query by doing the same as above.
10298

103-
[examples]: https://github.com/textkernel/tx-dotnet/tree/master/examples
99+
[examples]: https://github.com/textkernel/tx-dotnet/tree/master/src/Textkernel.Tx.SDK.Examples
104100
[portal]: https://cloud.textkernel.com/tx/console
105101
[api-docs]: https://developer.textkernel.com/tx-platform/v10/overview/
106102
[dotnet-core-cli-tools]: https://docs.microsoft.com/en-us/dotnet/core/tools/
107103
[nuget-cli]: https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference
108104
[package-manager-console]: https://docs.microsoft.com/en-us/nuget/tools/package-manager-console
109105
[docfx-docs]: https://textkernel.github.io/tx-dotnet/sdk/
106+
[docfx-txclient]: https://textkernel.github.io/tx-dotnet/sdk/Textkernel.Tx.ITxClient.html
110107
[http-client]: https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient
111108
[http-client-guidelines]: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines
112109
[http-extensions]: https://www.nuget.org/packages/Microsoft.Extensions.Http

docs/site-/favicon.ico

-97.3 KB
Binary file not shown.
-19.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)