mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +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.apache.log4j.Logger;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.core.ConfigurationManager;
|
||||||
import org.dspace.storage.rdbms.DatabaseManager;
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.dspace.storage.rdbms.TableRow;
|
import org.dspace.storage.rdbms.TableRow;
|
||||||
import org.dspace.storage.rdbms.TableRowIterator;
|
import org.dspace.storage.rdbms.TableRowIterator;
|
||||||
@@ -193,10 +194,12 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String[] arr = new String[3];
|
String[] arr = new String[5];
|
||||||
arr[0] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(sort_value)";
|
arr[0] = "CREATE INDEX " + disTable + "_svalue_idx ON " + disTable + "(sort_value)";
|
||||||
arr[1] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id)";
|
arr[1] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(value)";
|
||||||
arr[2] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id)";
|
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)
|
if (execute)
|
||||||
{
|
{
|
||||||
@@ -520,10 +523,20 @@ public class BrowseCreateDAOOracle implements BrowseCreateDAO
|
|||||||
Object[] params = { value };
|
Object[] params = { value };
|
||||||
String select = "SELECT id FROM " + table;
|
String select = "SELECT id FROM " + table;
|
||||||
|
|
||||||
if (isValueColumnClob())
|
if (ConfigurationManager.getBooleanProperty("webui.browse.metadata.case-insensitive", false))
|
||||||
select = select + " WHERE TO_CHAR(value)=?";
|
{
|
||||||
|
if (isValueColumnClob())
|
||||||
|
select = select + " WHERE UPPER(TO_CHAR(value))=UPPER(?)";
|
||||||
|
else
|
||||||
|
select = select + " WHERE UPPER(value)=UPPER(?)";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
select = select + " WHERE value=?";
|
{
|
||||||
|
if (isValueColumnClob())
|
||||||
|
select = select + " WHERE TO_CHAR(value)=?";
|
||||||
|
else
|
||||||
|
select = select + " WHERE value=?";
|
||||||
|
}
|
||||||
|
|
||||||
tri = DatabaseManager.query(context, select, params);
|
tri = DatabaseManager.query(context, select, params);
|
||||||
int distinctID = -1;
|
int distinctID = -1;
|
||||||
|
@@ -47,6 +47,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
import org.dspace.core.ConfigurationManager;
|
||||||
import org.dspace.storage.rdbms.DatabaseManager;
|
import org.dspace.storage.rdbms.DatabaseManager;
|
||||||
import org.dspace.storage.rdbms.TableRow;
|
import org.dspace.storage.rdbms.TableRow;
|
||||||
import org.dspace.storage.rdbms.TableRowIterator;
|
import org.dspace.storage.rdbms.TableRowIterator;
|
||||||
@@ -189,10 +190,12 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String[] arr = new String[3];
|
String[] arr = new String[5];
|
||||||
arr[0] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(sort_value);";
|
arr[0] = "CREATE INDEX " + disTable + "_svalue_idx ON " + disTable + "(sort_value)";
|
||||||
arr[1] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id);";
|
arr[1] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(value)";
|
||||||
arr[2] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id);";
|
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)
|
if (execute)
|
||||||
{
|
{
|
||||||
@@ -522,7 +525,17 @@ public class BrowseCreateDAOPostgres implements BrowseCreateDAO
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object[] params = { value };
|
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);
|
tri = DatabaseManager.query(context, select, params);
|
||||||
int distinctID = -1;
|
int distinctID = -1;
|
||||||
if (!tri.hasNext())
|
if (!tri.hasNext())
|
||||||
|
@@ -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.2 = dateissued:dc.date.issued:date
|
||||||
webui.itemlist.sort-option.3 = dateaccessioned:dc.date.accessioned: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.
|
# 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
|
# The default is 0, which is unlimited size for fields holding indexed data. Some
|
||||||
|
Reference in New Issue
Block a user