mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Add an extra index to the metadata (distinct) tables for better scalability.
Add option for 'case-insensitive' metadata browse tables, as a way to avoid the problems of duplicate entries. git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3216 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -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;
|
||||
|
@@ -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())
|
||||
|
Reference in New Issue
Block a user