Skip to content

Commit

Permalink
Merge pull request #1167 from JasperFx/feature/FullTextImprovements
Browse files Browse the repository at this point in the history
Full text improvements
  • Loading branch information
mysticmind authored Feb 13, 2019
2 parents 97eb202 + 7dfdcb7 commit 6fc1c4e
Show file tree
Hide file tree
Showing 27 changed files with 1,401 additions and 175 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Marten also provides .NET developers with an ACID-compliant event store with use

Before getting started you will need the following in your environment:

**1. .NET Core SDK 2.0+**
**1. .NET Core SDK 2.1**

Available [here](https://www.microsoft.com/net/download/core)

Expand Down Expand Up @@ -91,13 +91,11 @@ dotnet restore src\Marten.sln
dotnet build src\Marten.sln
# running tests for a specific target framework
dotnet test src\Marten.Testing\Marten.Testing.csproj --framework netcoreapp2.0
dotnet run -p martenbuild.csproj -- test
# mocha tests
npm install
npm run test
dotnet run -p martenbuild.csproj -- mocha
# running documentation website locally
dotnet restore docs.csproj
dotnet stdocs run
dotnet run -p martenbuild.csproj -- docs
```
76 changes: 76 additions & 0 deletions documentation/documentation/documents/configuration/full_text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!--title:Full Text Indexes-->

Full Text Indexes in Marten are built based on <[linkto:documentation/documents/configuration/gin_or_gist_index;title=Gin Indexes]> utilizing [Postgres built in Text Search functions](https://www.postgresql.org/docs/10/textsearch-controls.html). This enables the possibility to do more sophisticated searching through text fields.

<div class="alert alert-warning">
To use this feature, you will need to use PostgreSQL version 10.0 or above, as this is the first version that support text search function on jsonb column - this is also the data type that Marten use to store it's data.
</div>

## Definining Full Text Index through Store options

Full Text Indexes can be created using the fluent interface of `StoreOptions` like this:


* one index for whole document - all document properties values will be indexed

<[sample:using_whole_document_full_text_index_through_store_options_with_default]>

<div class="alert alert-info">
If you don't specify language (regConfig) - by default it will be created with 'english' value.
</div>

* single property - there is possibility to specify specific property to be indexed

<[sample:using_a_single_property_full_text_index_through_store_options_with_default]>

* single property with custom settings

<[sample:using_a_single_property_full_text_index_through_store_options_with_custom_settings]>

* multiple properties

<[sample:using_multiple_properties_full_text_index_through_store_options_with_default]>

* multiple properties with custom settings

<[sample:using_multiple_properties_full_text_index_through_store_options_with_custom_settings]>

* more than one index for document with different languages (regConfig)

<[sample:using_more_than_one_full_text_index_through_store_options_with_different_reg_config]>

## Defining Full Text Index through Attribute

Full Text Indexes can be created using the `[FullTextIndex]` attribute like this:

* one index for whole document - by setting attribute on the class all document properties values will be indexed

<[sample:using_a_full_text_index_through_attribute_on_class_with_default]>

* single property

<[sample:using_a_single_property_full_text_index_through_store_options_with_default]>

<div class="alert alert-info">
If you don't specify regConfig - by default it will be created with 'english' value.
</div>

* single property with custom settings

<[sample:using_a_single_property_full_text_index_through_store_options_with_custom_settings]>

* multiple properties

<[sample:using_multiple_properties_full_text_index_through_store_options_with_default]>

<div class="alert alert-info">
To group multiple properties into single index you need to specify the same values in `IndexName` parameters.
</div>

* one index for multiple properties with custom settings

<[sample:using_multiple_properties_full_text_index_through_store_options_with_custom_settings]>

* multiple indexes for multiple properties with custom settings

<[sample:using_more_than_one_full_text_index_through_store_options_with_different_reg_config]>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Marten supports both <[linkto:documentation/documents/configuration/duplicated_f

## Definining Unique Index through Store options

Unique Indexes can be created using the fluent interface off of `StoreOptions` like this:
Unique Indexes can be created using the fluent interface of `StoreOptions` like this:

1. **Computed**:
* single property
Expand Down
26 changes: 26 additions & 0 deletions documentation/documentation/documents/querying/linq.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,32 @@ Query data from all tenants using `AnyTenant` method.
Use `TenantIsOneOf` to query on a selected list of tenants.
<[sample:tenant_is_one_of]>

## Text Search

Postgres contains built in [Text Search functions](https://www.postgresql.org/docs/10/textsearch-controls.html). They enable the possibility to do more sophisticated searching through text fields. Marten gives possibility to define <[linkto:documentation/documents/configuration/full_text;title=Full Text Indexes]> and perform queries on them.
Currently three types of full Text Search functions are supported:

* regular Search (to_tsquery)

<[sample:search_in_query_sample]>

* plain text Search (plainto_tsquery)

<[sample:plain_search_in_query_sample]>

* phrase Search (phraseto_tsquery)

<[sample:phrase_search_in_query_sample]>

All types of Text Searches can be combined with other Linq queries

<[sample:text_search_combined_with_other_query_sample]>

They allow also to specify language (regConfig) of the text search query (by default `english` is being used)

<[sample:text_search_with_non_default_regConfig_sample]>


## Supported Types

At this point, Marten's Linq support has been tested against these .Net types:
Expand Down
2 changes: 1 addition & 1 deletion martenbuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace martenbuild
{
class MartenBuild
{
private const string BUILD_VERSION = "3.1.0";
private const string BUILD_VERSION = "3.3.0";

static void Main(string[] args)
{
Expand Down
2 changes: 1 addition & 1 deletion rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

COMPILE_TARGET = ENV['config'].nil? ? "debug" : ENV['config']
RESULTS_DIR = "results"
BUILD_VERSION = '3.1.0'
BUILD_VERSION = '3.3.0'

CONNECTION = ENV['connection']

Expand Down
Loading

0 comments on commit 6fc1c4e

Please sign in to comment.