Skip to content

Commit

Permalink
FIX: Revert wrong content of commit e66b1cd
Browse files Browse the repository at this point in the history
  • Loading branch information
sdqri committed Sep 23, 2024
1 parent 1498c35 commit 8ef0315
Show file tree
Hide file tree
Showing 45 changed files with 422 additions and 1,949 deletions.
5 changes: 2 additions & 3 deletions docs-src/docs/bool_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ The bool query adopts a more-matches-is-better approach, so the score from each
```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
mq "github.com/sdqri/effdsl/v2/queries/matchquery"
bq "github.com/sdqri/effdsl/v2/queries/boolquery"
mq "github.com/sdqri/effdsl/queries/matchquery"
bq "github.com/sdqri/effdsl/queries/boolquery"
)

query, err := effdsl.Define(
Expand Down
10 changes: 4 additions & 6 deletions docs-src/docs/boosting_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ A boosting query matches documents based on a positive query while reducing the
```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
bq "github.com/sdqri/effdsl/v2/queries/boostingquery"
tq "github.com/sdqri/effdsl/v2/queries/termquery"
bq "github.com/sdqri/effdsl/queries/boostingquery"
tq "github.com/sdqri/effdsl/queries/termquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
bq.BoostingQuery(
tq.TermQuery("text", "apple"),
tq.TermQuery("text", "pie tart fruit crumble tree"),
0.5,
),
),
0.5),
),
)

res, err := es.Search(
Expand Down
8 changes: 3 additions & 5 deletions docs-src/docs/constant_score.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ A constant score query wraps a filter query and returns every matching document
```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
csq "github.com/sdqri/effdsl/v2/queries/constantscore"
tq "github.com/sdqri/effdsl/v2/queries/termquery"
csq "github.com/sdqri/effdsl/queries/constantscore"
tq "github.com/sdqri/effdsl/queries/termquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
csq.ConstantScoreQuery(
tq.TermQuery("user.id", "kimchy"),
1.2
),
1.2),
),
)

Expand Down
5 changes: 2 additions & 3 deletions docs-src/docs/dis_max_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ A disjunction max query (dis_max) is used to find documents that match multiple
```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
dmq "github.com/sdqri/effdsl/v2/queries/dismaxquery"
tq "github.com/sdqri/effdsl/v2/queries/termquery"
dmq "github.com/sdqri/effdsl/queries/dismaxquery"
tq "github.com/sdqri/effdsl/queries/termquery"
)

query, err := effdsl.Define(
Expand Down
3 changes: 1 addition & 2 deletions docs-src/docs/exists_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ An exists query returns documents that contain an indexed value for a specified
```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
eq "github.com/sdqri/effdsl/v2/queries/existsquery"
eq "github.com/sdqri/effdsl/queries/existsquery"
)

query, err := effdsl.Define(
Expand Down
5 changes: 2 additions & 3 deletions docs-src/docs/fuzzy_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ To find similar terms, the fuzzy query creates a set of all possible variations,

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
eq "github.com/sdqri/effdsl/v2/queries/existsquery"
eq "github.com/sdqri/effdsl/queries/existsquery"
)

query, err := effdsl.Define(
Expand Down
5 changes: 2 additions & 3 deletions docs-src/docs/ids_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ Returns documents based on their IDs.

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
iq "github.com/sdqri/effdsl/v2/queries/idsquery"
iq "github.com/sdqri/effdsl/queries/idsquery"
)

query, err := effdsl.Define(
Expand Down
6 changes: 3 additions & 3 deletions docs-src/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ to your code, and then `go [build|run|test]` will automatically fetch the necess
Otherwise, run the following Go command to install the `effdsl` package:

```sh
$ go get -u github.com/sdqri/effdsl/v2
$ go get -u github.com/sdqri/effdsl
```

### How to use
Expand Down Expand Up @@ -76,8 +76,8 @@ import (

query, err := effdsl.Define(
effdsl.WithQuery(
mq.MatchQuery("message", "Hello World"),
),
mq.MatchQuery("message", "Hello World")
),
)

res, err := es.Search(
Expand Down
5 changes: 2 additions & 3 deletions docs-src/docs/match_bool_prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ A match bool prefix query analyzes its input and constructs a bool query from th

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
mbpq "github.com/sdqri/effdsl/v2/queries/matchboolprefix"
mbpq "github.com/sdqri/effdsl/queries/matchboolprefix"
)

query, err := effdsl.Define(
Expand Down
5 changes: 2 additions & 3 deletions docs-src/docs/match_phrase_prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ A match phrase prefix query returns documents that match a given phrase with a p

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
mppq "github.com/sdqri/effdsl/v2/queries/matchphraseprefixquery"
mppq "github.com/sdqri/effdsl/queries/matchphraseprefixquery"
)

query, err := effdsl.Define(
Expand Down
52 changes: 2 additions & 50 deletions docs-src/docs/match_phrase_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,9 @@ A match phrase query returns documents that match a given phrase, considering th

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
mppq "github.com/sdqri/effdsl/v2/queries/matchphraseprefixquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
mppq.MatchPhrasePrefixQuery(
"field_name",
"some phrase prefix query",
mppq.WithAnalyzer("my_analyzer"),
mppq.WithSlop(2),
mppq.WithMaxExpansions(10),
),
),
)

res, err := es.Search(
es.Search.WithBody(strings.NewReader(query)),
)
```
### Parameters

* **Field (string)**
_(Required, positional)_ The field to search. This is a required parameter.

* **Query (string)**
_(Required, positional)_ The text to search for in the provided field. This is a required parameter.

* **WithAnalyzer (string)**
_(Optional, Functional option)_ Analyzer used to convert the text in the query value into tokens. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.

* **WithSlop (int)**
_(Optional, Functional option)_ Maximum number of positions allowed between matching tokens for phrases. Defaults to 0.

* **WithMaxExpansions (int)**
_(Optional, Functional option)_ Maximum number of terms to which the last provided term will expand. Defaults to not expanding terms.

* **WithZeroTermsQuery (ZeroTerms)**
_(Optional, Functional option)_ Indicates what to do when the analyzed text contains no terms. Valid values are:

* `none` (Default): No documents are returned if the analyzer removes all tokens.
* `all`: Returns all documents, similar to a match_all query.

### Additional Information

For more details on the match phrase prefix query and its parameters, refer to the [official Elasticsearch documentation on match phrase prefix queries](https://elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html).

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
mpq "github.com/sdqri/effdsl/v2/queries/matchphrasequery"
mpq "github.com/sdqri/effdsl/queries/matchphrasequery"
)

query, err := effdsl.Define(
Expand Down
51 changes: 2 additions & 49 deletions docs-src/docs/match_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,9 @@ A match query returns documents that match a provided text, number, date, or boo

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
mq "github.com/sdqri/effdsl/v2/queries/matchquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
mq.MatchQuery(
"field_name",
"some match query",
mq.WithOperator(mq.AND),
mq.WithFuzzinessParameter(mq.FuzzinessAUTO),
),
),
)

res, err := es.Search(
es.Search.WithBody(strings.NewReader(query)),
)
```
### Parameters

* **Field (string)**
_(Required, positional)_ The field to search. This is a required parameter.

* **Query (string)**
_(Required, positional)_ The text to search for in the provided field. This is a required parameter.

* **WithAnalyzer (string)**
_(Optional, Functional option)_ Analyzer used to convert the text in the query value into tokens. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.

* **WithSlop (int)**
_(Optional, Functional option)_ Maximum number of positions allowed between matching tokens for phrases. Defaults to 0.

* **WithMaxExpansions (int)**
_(Optional, Functional option)_ Maximum number of terms to which the last provided term will expand. Defaults to not expanding terms.

* **WithZeroTermsQuery (ZeroTerms)**
_(Optional, Functional option)_ Indicates what to do when the analyzed text contains no terms. Valid values are:

* `none` (Default): No documents are returned if the analyzer removes all tokens.
* `all`: Returns all documents, similar to a match_all query.

### Additional Information

For more details on the match phrase prefix query and its parameters, refer to the [official Elasticsearch documentation on match phrase prefix queries](https://elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html).

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
mq "github.com/sdqri/effdsl/v2/queries/matchquery"
mq "github.com/sdqri/effdsl/queries/matchquery"
)

query, err := effdsl.Define(
Expand Down
52 changes: 2 additions & 50 deletions docs-src/docs/prefix_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,9 @@ A prefix query returns documents that contain terms starting with the specified

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
mppq "github.com/sdqri/effdsl/v2/queries/matchphraseprefixquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
mppq.MatchPhrasePrefixQuery(
"field_name",
"some phrase prefix query",
mppq.WithAnalyzer("my_analyzer"),
mppq.WithSlop(2),
mppq.WithMaxExpansions(10),
),
),
)

res, err := es.Search(
es.Search.WithBody(strings.NewReader(query)),
)
```
### Parameters

* **Field (string)**
_(Required, positional)_ The field to search. This is a required parameter.

* **Query (string)**
_(Required, positional)_ The text to search for in the provided field. This is a required parameter.

* **WithAnalyzer (string)**
_(Optional, Functional option)_ Analyzer used to convert the text in the query value into tokens. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.

* **WithSlop (int)**
_(Optional, Functional option)_ Maximum number of positions allowed between matching tokens for phrases. Defaults to 0.

* **WithMaxExpansions (int)**
_(Optional, Functional option)_ Maximum number of terms to which the last provided term will expand. Defaults to not expanding terms.

* **WithZeroTermsQuery (ZeroTerms)**
_(Optional, Functional option)_ Indicates what to do when the analyzed text contains no terms. Valid values are:

* `none` (Default): No documents are returned if the analyzer removes all tokens.
* `all`: Returns all documents, similar to a match_all query.

### Additional Information

For more details on the match phrase prefix query and its parameters, refer to the [official Elasticsearch documentation on match phrase prefix queries](https://elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html).

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
pq "github.com/sdqri/effdsl/v2/queries/prefixquery"
pq "github.com/sdqri/effdsl/queries/prefixquery"
)

query, err := effdsl.Define(
Expand Down
52 changes: 2 additions & 50 deletions docs-src/docs/query_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,9 @@ A query string query parses and executes a search query based on a query string

```go
import (
es "github.com/elastic/go-elasticsearch/v8"

"github.com/sdqri/effdsl/v2"
mppq "github.com/sdqri/effdsl/v2/queries/matchphraseprefixquery"
)

query, err := effdsl.Define(
effdsl.WithQuery(
mppq.MatchPhrasePrefixQuery(
"field_name",
"some phrase prefix query",
mppq.WithAnalyzer("my_analyzer"),
mppq.WithSlop(2),
mppq.WithMaxExpansions(10),
),
),
)

res, err := es.Search(
es.Search.WithBody(strings.NewReader(query)),
)
```
### Parameters

* **Field (string)**
_(Required, positional)_ The field to search. This is a required parameter.

* **Query (string)**
_(Required, positional)_ The text to search for in the provided field. This is a required parameter.

* **WithAnalyzer (string)**
_(Optional, Functional option)_ Analyzer used to convert the text in the query value into tokens. Defaults to the index-time analyzer mapped for the field. If no analyzer is mapped, the index’s default analyzer is used.

* **WithSlop (int)**
_(Optional, Functional option)_ Maximum number of positions allowed between matching tokens for phrases. Defaults to 0.

* **WithMaxExpansions (int)**
_(Optional, Functional option)_ Maximum number of terms to which the last provided term will expand. Defaults to not expanding terms.

* **WithZeroTermsQuery (ZeroTerms)**
_(Optional, Functional option)_ Indicates what to do when the analyzed text contains no terms. Valid values are:

* `none` (Default): No documents are returned if the analyzer removes all tokens.
* `all`: Returns all documents, similar to a match_all query.

### Additional Information

For more details on the match phrase prefix query and its parameters, refer to the [official Elasticsearch documentation on match phrase prefix queries](https://elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html).

es "github.com/elastic/go-elasticsearch/v8"
"github.com/sdqri/effdsl/v2"
qs "github.com/sdqri/effdsl/v2/queries/querystring"
qs "github.com/sdqri/effdsl/queries/querystring"
)

query, err := effdsl.Define(
Expand Down
Loading

0 comments on commit 8ef0315

Please sign in to comment.