Skip to content

Commit e60ab89

Browse files
committed
Polishing.
Gzip input data. Reformat code, replace space indents with tab indents. Convert readme to Asciidoc. See #690
1 parent 8d0bde0 commit e60ab89

File tree

5 files changed

+300
-629907
lines changed

5 files changed

+300
-629907
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
1-
# Spring Data - Fragment SPI Example
1+
= Spring Data - Fragment SPI Example
22

3-
This project contains a sample using `spring.factories` to register implementation details for a repository extension for MongoDB Vector Search that lives outside of the project namespace.
3+
This project contains a sample using `spring.factories` to register implementation details for a repository extension for MongoDB Vector Search that lives outside the project namespace.
44

55
The project is divided into the `atlas-api`, providing the extension, and the `sample` using it.
66

7-
## atlas-api
7+
== atlas-api
88

99
The `AtlasRepository` is the base interface containing a `vectorSearch` method that is implemented in `AtlasRepositoryFragment`. The configuration in `src/main/resources/META-INF/spring.factories` makes sure it is picked up by the spring data infrastructure.
1010

1111
The implementation leverages `RepositoryMethodContext` to get hold of method invocation metadata to determine the collection name derived from the repositories domain type `<T>`.
12-
Since providing the metadata needs to be explicitly activated the `AtlasRepositoryFragment` uses the additional marker interface `RepositoryMetadataAccess` enabling the features for repositories extending the `AtlasRepository`.
12+
Since providing the metadata needs to be explicitly activated the `AtlasRepositoryFragment` uses the additional marker interface `RepositoryMetadataAccess` enabling the features for repositories extending the `AtlasRepository`.
1313

14-
## sample
14+
== sample
1515

1616
The `MovieRepository` extends the `AtlasRepository` from the api project using a `Movie` type targeting the `movies` collection. No further configuration is needed to use the provided `vectorSearch` within the `MovieRepositoryTests`.
1717

1818
The `Movies` class in `src/main/test` takes care of setting up required test data and indexes.
1919

20-
## Running the sample
20+
== Running the sample
2121

2222
The is using a local MongoDB Atlas instance bootstrapped by Testcontainers.
23-
Running the `MovieRepositoryTests` the `test/movies` collection will be populated with about 400 entries from the `mflix.embedded_movies.json` file.
24-
Please be patient while data is loaded into the database and the index created afterwards.
23+
Running the `MovieRepositoryTests` the `test/movies` collection will be populated with about 400 entries from the `mflix.embedded_movies.json.gz` file.
24+
Please be patient while data is loaded into the database and the index created afterward.
2525
Progress information will be printed to the log.
26-
```log
27-
INFO - com.example.data.mongodb.Movies: 73 - Loading movies mflix.embedded_movies.json
26+
27+
[source,log]
28+
----
29+
INFO - com.example.data.mongodb.Movies: 73 - Loading movies from class path resource [mflix.embedded_movies.json.gz]
2830
INFO - com.example.data.mongodb.Movies: 90 - Created 420 movies in test.movies
2931
INFO - com.example.data.mongodb.Movies: 65 - creating vector index
3032
INFO - com.example.data.mongodb.Movies: 68 - index 'plot_vector_index' created
31-
```
33+
----
34+
3235
Once data and index are available search result will be printed:
33-
```log
36+
37+
[source,log]
38+
----
3439
INFO - ...mongodb.MovieRepositoryTests: 183 - Movie{id='66d6ee0937e07b74aa2939cc', ...
35-
```
40+
----

0 commit comments

Comments
 (0)