diff --git a/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOOracle.java b/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOOracle.java index d6393d5cc0..7ebdec1099 100644 --- a/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOOracle.java +++ b/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOOracle.java @@ -47,6 +47,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.dspace.core.Context; +import org.dspace.core.ConfigurationManager; import org.dspace.storage.rdbms.DatabaseManager; import org.dspace.storage.rdbms.TableRow; import org.dspace.storage.rdbms.TableRowIterator; @@ -193,10 +194,12 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO { try { - String[] arr = new String[3]; - arr[0] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(sort_value)"; - arr[1] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id)"; - arr[2] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id)"; + String[] arr = new String[5]; + arr[0] = "CREATE INDEX " + disTable + "_svalue_idx ON " + disTable + "(sort_value)"; + arr[1] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(value)"; + arr[2] = "CREATE INDEX " + disTable + "_uvalue_idx ON " + disTable + "(UPPER(value))"; + arr[3] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id)"; + arr[4] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id)"; if (execute) { @@ -520,10 +523,20 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO Object[] params = { value }; String select = "SELECT id FROM " + table; - if (isValueColumnClob()) - select = select + " WHERE TO_CHAR(value)=?"; + if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false)) + { + if (isValueColumnClob()) + select = select + " WHERE UPPER(TO_CHAR(value))=UPPER(?)"; + else + select = select + " WHERE UPPER(value)=UPPER(?)"; + } else - select = select + " WHERE value=?"; + { + if (isValueColumnClob()) + select = select + " WHERE TO_CHAR(value)=?"; + else + select = select + " WHERE value=?"; + } tri = DatabaseManager.query(context, select, params); int distinctID = -1; diff --git a/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOPostgres.java b/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOPostgres.java index c0f2459de5..fe05ae8663 100644 --- a/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOPostgres.java +++ b/dspace-api/src/main/java/org/dspace/browse/BrowseCreateDAOPostgres.java @@ -47,6 +47,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.dspace.core.Context; +import org.dspace.core.ConfigurationManager; import org.dspace.storage.rdbms.DatabaseManager; import org.dspace.storage.rdbms.TableRow; import org.dspace.storage.rdbms.TableRowIterator; @@ -189,10 +190,12 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO { try { - String[] arr = new String[3]; - arr[0] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(sort_value);"; - arr[1] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id);"; - arr[2] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id);"; + String[] arr = new String[5]; + arr[0] = "CREATE INDEX " + disTable + "_svalue_idx ON " + disTable + "(sort_value)"; + arr[1] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(value)"; + arr[2] = "CREATE INDEX " + disTable + "_uvalue_idx ON " + disTable + "(UPPER(value))"; + arr[3] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id)"; + arr[4] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id)"; if (execute) { @@ -522,7 +525,17 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO try { Object[] params = { value }; - String select = "SELECT id FROM " + table + " WHERE value = ?"; + String select = null; + + if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false)) + { + select = "SELECT id FROM " + table + " WHERE UPPER(value) = UPPER(?)"; + } + else + { + select = "SELECT id FROM " + table + " WHERE value = ?"; + } + tri = DatabaseManager.query(context, select, params); int distinctID = -1; if (!tri.hasNext()) diff --git a/dspace/config/dspace.cfg b/dspace/config/dspace.cfg index 70a4dcff92..9db029c1fa 100644 --- a/dspace/config/dspace.cfg +++ b/dspace/config/dspace.cfg @@ -817,6 +817,24 @@ webui.itemlist.sort-option.1 = title:dc.title:title webui.itemlist.sort-option.2 = dateissued:dc.date.issued:date webui.itemlist.sort-option.3 = dateaccessioned:dc.date.accessioned:date +# By default, the display of metadata in the browse indexes is case sensitive +# So, you will get seperate entries for the terms +# +# Olive oil +# olive oil +# +# However, clicking through from either of these will result in the same set of items +# (ie. any item that contains either representation in the correct field). +# +# Uncommenting the option below will make the metadata items case-insensitive. This will +# result in a single entry in the example above. However the value displayed may be either 'Olive oil' +# or 'olive oil' - depending on what representation was present in the first item indexed. +# +# If you care about the display of the metadata in the browse index - well, you'll have to go and +# fix the metadata in your items. +# +# webui.browse.metadata.case-insensitive = true + # Set the options for the size (number of characters) of the fields stored in the database. # # The default is 0, which is unlimited size for fields holding indexed data. Some