changeset 71:dfedca84c36b

Fixed up saving of tags with empty values and card hiding
author Fox
date Sat, 24 Dec 2022 22:00:36 +0100
parents fc040f668d55
children 3f25b75e6dac
files src/junotu/Card.java src/junotu/Database.java src/junotu/TabEdit.java
diffstat 3 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/junotu/Card.java	Sat Dec 24 12:16:19 2022 +0100
+++ b/src/junotu/Card.java	Sat Dec 24 22:00:36 2022 +0100
@@ -26,7 +26,7 @@
     public static final String VALUE_BOARD_COLUMN_CARD_ONLY = "only";
 
     public static final String HIDE_TAGS[] = {
-	TAG_BOARD_COLUMN_CARDS,
+	TAG_BOARD_COLUMN,
     };
 
     public static final String HIDE_TAG_VALUES[] = {
--- a/src/junotu/Database.java	Sat Dec 24 12:16:19 2022 +0100
+++ b/src/junotu/Database.java	Sat Dec 24 22:00:36 2022 +0100
@@ -169,8 +169,9 @@
 		} else {
 		    search += tag+" "+value.toString()+" ";
 		}
-		if( value == null ) {
+		if( value == null || "".equals(value) ) {
 		    if( !tag.equals("") ) {
+			/* It seems that if a field with empty string value is analyzed, it isn't searchable at all. */
 			document.add( new Field( tag, "", Field.Store.YES, Field.Index.NOT_ANALYZED ) );
 		    }
 	        } else if( value instanceof String ) {
--- a/src/junotu/TabEdit.java	Sat Dec 24 12:16:19 2022 +0100
+++ b/src/junotu/TabEdit.java	Sat Dec 24 22:00:36 2022 +0100
@@ -310,7 +310,11 @@
 	{
 	    String[] split = editedTagField.getText().split( ":", 2 );
 	    newTag = split[0];
-	    newValue = split.length > 1 ? split[1] : null;
+	    if( split.length > 1 && !split[1].equals("") ) {
+		newValue = split[1];
+	    } else {
+		newValue = null;
+	    }
 	}
 
 	/* Either editing tag, or adding a new one. */