Skip to content

Commit c3c76f6

Browse files
committed
Generate FTS only for projects without special shopping list db by default
1 parent 42f8c73 commit c3c76f6

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

core/src/main/java/io/snabble/sdk/ProductDatabase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ private void exec(String sql) {
11111111
}
11121112
}
11131113

1114-
private String bindArgs(String sql, String[] args) {
1114+
public static String bindArgs(String sql, String[] args) {
11151115
if (args == null) {
11161116
return sql;
11171117
}

core/src/main/java/io/snabble/sdk/Project.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public class Project {
9999
.build();
100100

101101
boolean generateSearchIndex = snabble.getConfig().generateSearchIndex;
102+
// Generate FTS if the shopping list is used and there is no shopping list database
103+
if (snabble.getConfig().isUsingShoppingList && getShoppingListDbUrl() == null) {
104+
generateSearchIndex = true;
105+
}
102106

103107
productDatabase = new ProductDatabase(this, id + ".sqlite3", generateSearchIndex);
104108
shoppingCartStorage = new ShoppingCartStorage(this);

core/src/main/java/io/snabble/sdk/Snabble.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,15 @@ public static class Config {
724724
*/
725725
public boolean generateSearchIndex;
726726

727+
/**
728+
* If set to true, the SDK downloads the shopping list meta data are present or creates an
729+
* full text index for the product data.
730+
* <p>
731+
* Note that this increases setup time of the ProductDatabase when there are no shopping
732+
* list meta data, and it may not be immediately available offline.
733+
*/
734+
public boolean isUsingShoppingList;
735+
727736
/**
728737
* The time that the database is allowed to be out of date. After the specified time in
729738
* milliseconds the database only uses online requests for asynchronous requests.

0 commit comments

Comments
 (0)