Skip to content

Commit ad8ba2e

Browse files
committed
Add photo tree search template in configuration
1 parent 3b9e4a5 commit ad8ba2e

File tree

13 files changed

+46
-20
lines changed

13 files changed

+46
-20
lines changed

Makefile renamed to GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ IMAGE_FQIN:=asaintsever/tinyworld
1313
.DEFAULT_GOAL := help
1414

1515
help: ## Show Help
16-
grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
16+
grep -E '^[a-zA-Z_-]+:.*?## .*$$' *makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1717

1818
init: ## Init build (to run once)
1919
mvn validate

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- Geolocalize photos on virtual globe with metadata in annotations
1414
- Search & filter capabilities to easily navigate your photos (by dates, countries, ...)
1515
- Offline mode (use local cache for globe data)
16-
- Available as portable app, AppImage package and OCI image
16+
- Available as portable app, AppImage package and OCI image *(i.e. container)*
1717

1818
## Supported Photo Formats
1919

@@ -24,7 +24,7 @@
2424
## Requirements
2525

2626
- Linux or WSL2 for AppImage
27-
- Docker or Podman for OCI image
27+
- Docker or [Podman](https://podman.io/) for OCI image
2828

2929
## Configuration
3030

@@ -60,7 +60,7 @@ By default, 4Gb of memory is set via Xmx/Xms Java options. You can override this
6060
JAVA_OPTS="-Xmx2048m -Xms1024m" ./TinyWorld-<release version>-x86_64.AppImage
6161
```
6262

63-
### Using OCI Image on Linux/WSL2
63+
### Using OCI Image
6464

6565
```sh
6666
<docker|podman> run --rm -e DISPLAY -v "$HOME/.Xauthority:/root/.Xauthority:rw" -v "$HOME/.tinyworld:/root/.tinyworld" -v "$HOME/var/cache:/root/var/cache" --network host asaintsever/tinyworld:<release version>
@@ -87,8 +87,11 @@ In case you experience scaling issue with High DPI (such as globe not filling th
8787

8888
### Requirements
8989

90-
- Make
91-
- Maven 3
90+
- GNU Make 4+
91+
92+
> *On MacOS, you can install/update GNU Make using [brew](https://brew.sh/): `brew install make`*
93+
94+
- Maven 3+
9295
- Java JDK 17
9396
- zip/unzip *(to generate TinyWorld portable app for Windows)*
9497
- Podman *(to generate TinyWorld OCI image)*

cfg/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Following env vars allow to override values in TinyWorld's config file (`tinywor
1818
|-----|-----------------|-------------|
1919
| TW_UI_LOGS_WWJ | `on` (default), `off` | Enable logs for NASA WorldWind |
2020
| TW_UI_LOGS_FLATLAF | `on` (default), `off` | Enable logs for FlatLaf framework |
21+
| TW_UI_PHOTOTREE_FILTER_TMPL | Any valid search template name. Default is `year_month` | Search template to use in photo tree |
2122
| TW_IDX_CLUSTER_EMBEDDED | `true` (default), `false` | Use TinyWorld's embedded cluster (OpenSearch). Set to `false` to use your own ElasticSearch / OpenSearch cluster |
2223
| TW_IDX_CLUSTER_EMBEDDED_EXPOSE | `true`, `false` (default) | Expose embedded cluster to external machines (with CORS enabled as well) |
23-
| TW_IDX_CLUSTER_ADDRESS | any address. Default is `localhost` | Address of OpenSearch / Elasticsearch cluster |
24-
| TW_IDX_CLUSTER_PORT | a valid port number. Default is `9200` | Cluster listening port |
25-
| TW_IDX_CLUSTER_INDEX | any valid index name. Default is `photos` | Cluster index name |
24+
| TW_IDX_CLUSTER_ADDRESS | Any address. Default is `localhost` | Address of OpenSearch / Elasticsearch cluster |
25+
| TW_IDX_CLUSTER_PORT | A valid port number. Default is `9200` | Cluster listening port |
26+
| TW_IDX_CLUSTER_INDEX | Any valid index name. Default is `photos` | Cluster index name |

cfg/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<artifactId>cfg</artifactId>
99

1010
<properties>
11-
<commons.text.version>1.9</commons.text.version>
11+
<commons.text.version>1.10.0</commons.text.version>
1212
</properties>
1313

1414
<dependencies>

cfg/src/main/java/asaintsever/tinyworld/cfg/Configuration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,22 @@ public class Configuration {
3232
@ToString
3333
public class UI {
3434
public Deps deps;
35+
public PhotoTree photoTree;
3536

3637
@ToString
3738
public class Deps {
3839
public Map<String, String> logging;
3940
}
41+
42+
@ToString
43+
public class PhotoTree {
44+
public Filter filter;
45+
46+
@ToString
47+
public class Filter {
48+
public String template;
49+
}
50+
}
4051
}
4152

4253
@ToString

cfg/src/main/java/asaintsever/tinyworld/cfg/Loader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Loader {
4444
private static StringSubstitutor stringSubstitutor = new StringSubstitutor(
4545
StringLookupFactory.INSTANCE.environmentVariableStringLookup());
4646

47-
public static void setPathToConfigFile(String pathCfg) {
47+
static void setPathToConfigFile(String pathCfg) {
4848
TINYWORLD_CONFIG_FILE_PATH = Paths.get(pathCfg);
4949
}
5050

cfg/src/main/resources/config/tinyworld.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ui:
55
logging: # logging for dependencies
66
wwj: ${TW_UI_LOGS_WWJ:-on} # on/off
77
flatlaf: ${TW_UI_LOGS_FLATLAF:-on} # on/off
8+
photoTree:
9+
filter:
10+
template: ${TW_UI_PHOTOTREE_FILTER_TMPL:-year_month} # search template to use: year_month, year_country_month, country_year_month
811

912
indexor:
1013
# Default TinyWorld's embedded cluster is running at localhost:9200

cfg/src/test/java/asaintsever/tinyworld/cfg/LoaderTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void loadDefaultInternalConfig() {
4545
assertEquals(cfg.indexor.cluster.address, "localhost");
4646
assertEquals(cfg.indexor.cluster.port, 9200);
4747
assertEquals(cfg.indexor.cluster.index, "photos");
48+
assertEquals(cfg.ui.photoTree.filter.template, "year_month");
4849
}
4950

5051
@Test
@@ -58,6 +59,7 @@ void loadDefaultInternalConfig() {
5859
@SetEnvironmentVariable(key = "TW_IDX_CLUSTER_ADDRESS", value = "127.0.0.1")
5960
@SetEnvironmentVariable(key = "TW_IDX_CLUSTER_PORT", value = "9210")
6061
@SetEnvironmentVariable(key = "TW_IDX_CLUSTER_INDEX", value = "test")
62+
@SetEnvironmentVariable(key = "TW_UI_PHOTOTREE_FILTER_TMPL", value = "country_year_month")
6163
void loadDefaultInternalConfigOverrideWithEnv() {
6264
Configuration cfg = Loader.getConfig(false);
6365
assertNotNull(cfg);
@@ -69,6 +71,7 @@ void loadDefaultInternalConfigOverrideWithEnv() {
6971
assertEquals(cfg.indexor.cluster.address, "127.0.0.1");
7072
assertEquals(cfg.indexor.cluster.port, 9210);
7173
assertEquals(cfg.indexor.cluster.index, "test");
74+
assertEquals(cfg.ui.photoTree.filter.template, "country_year_month");
7275
}
7376

7477
@Test
@@ -85,5 +88,6 @@ void loadCustomConfig() {
8588
assertEquals(cfg.indexor.cluster.address, "localhost");
8689
assertEquals(cfg.indexor.cluster.port, 9200);
8790
assertEquals(cfg.indexor.cluster.index, "my_index");
91+
assertEquals(cfg.ui.photoTree.filter.template, "year_country_month");
8892
}
8993
}

cfg/src/test/resources/cfg_test1.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ui:
55
logging: # logging for dependencies
66
wwj: off # on/off
77
flatlaf: off # on/off
8+
photoTree:
9+
filter:
10+
template: "year_country_month" # search template to use
811

912
indexor:
1013
# Default TinyWorld's embedded cluster is running at localhost:9200

indexor/src/main/java/asaintsever/tinyworld/indexor/opensearch/Document.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public class Document<T> implements Closeable {
5858
private String index;
5959

6060
// Used for search and templates only (new Java client search capabilities not on par compared to
61-
// high-level rest
62-
// client)
61+
// high-level rest client)
6362
// To be removed once new Java client fully supports all search expressions and search templates
6463
// aggregations
6564
private RestHighLevelClient restHlClient;

0 commit comments

Comments
 (0)