Search indexing all values (now getControlledVocabulariesDisplayValueLocalized returns a list of all the values and the DSIndexer manages these values)

A return statement is added if the item has no collection
This commit is contained in:
Rania Stathopoulou
2012-09-14 19:49:27 +03:00
parent 33da186e6c
commit b05c6a3288
2 changed files with 94 additions and 95 deletions

View File

@@ -362,10 +362,10 @@ public class Util {
/**
* Get the localized respective "displayed-value" from the given
* "stored-value" for a specific metadata field of a DSpace Item, by reading
* input-forms.xml. In this case the localized input-forms is used, e.g. input-forms_el.xml
/**
* Get a list of all the respective "displayed-value(s)" from the given
* "stored-value(s)" for a specific metadata field of a DSpace Item, by reading
* input-forms.xml
*
* @param item
* The Dspace Item
@@ -377,14 +377,12 @@ public class Util {
* A String with the element name of the metadata field
* @param qualifier
* A String with the qualifier name of the metadata field
* @param Locale
* The given locale
* @return A String of the respective "displayed-value"
* @return A list of the respective "displayed-values"
*/
public static String getControlledVocabulariesDisplayValueLocalized(Item item, DCValue[] values, String schema, String element, String qualifier, Locale locale) throws SQLException, DCInputsReaderException{
public static List getControlledVocabulariesDisplayValueLocalized(Item item, DCValue[] values, String schema, String element, String qualifier, Locale locale) throws SQLException, DCInputsReaderException{
String toReturn="";
List toReturn=new ArrayList<String>();
DCInput myInputs = null;
boolean myInputsFound=false;
String formFileName = I18nUtil.getInputFormsFileName(locale);
@@ -398,7 +396,8 @@ public class Util {
if (collection==null)
{
col_handle = "db-id/" + item.getID();
// col_handle = "db-id/" + item.getID();
return null;
}
else {
col_handle = collection.getHandle();
@@ -451,16 +450,12 @@ public class Util {
if (displayVal!=null && !"".equals(displayVal)){
return displayVal;
toReturn.add(displayVal);
}
}
}
return toReturn;
}
}

View File

@@ -1071,16 +1071,20 @@ public class DSIndexer
//Index the controlled vocabularies localized display values for all localized input-forms.xml (e.g. input-forms_el.xml)
if ("inputform".equalsIgnoreCase(indexConfigArr[i].type)){
List newValues=new ArrayList<String>();
String displayValue;
Locale[] supportedLocales=I18nUtil.getSupportedLocales();
//Get the display value of the respective stored value
for (int k=0;k<supportedLocales.length;k++){
List displayValues=new ArrayList<String>();
displayValues = org.dspace.app.util.Util.getControlledVocabulariesDisplayValueLocalized(item, mydc,indexConfigArr[i].schema, indexConfigArr[i].element, indexConfigArr[i].qualifier, supportedLocales[k]);
if (displayValues!=null && !displayValues.isEmpty()){
for (int d=0;d<displayValues.size();d++){
newValues.add(displayValues.get(d));
}
}
displayValue = org.dspace.app.util.Util.getControlledVocabulariesDisplayValueLocalized(item, mydc,indexConfigArr[i].schema, indexConfigArr[i].element, indexConfigArr[i].qualifier, supportedLocales[k]);
newValues.add(displayValue);
}
if (newValues!=null){