Skip to content

Commit

Permalink
Code changed in order to index both stored and display-value for all …
Browse files Browse the repository at this point in the history
…localized input-forms if the user specifies 'inputform' in Search Index Configuration of dspace.cfg, e.g: search.index.12 = language:dc.language:inputform
  • Loading branch information
iostath committed Sep 11, 2012
1 parent d278958 commit c31651b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 56 deletions.
51 changes: 2 additions & 49 deletions dspace-api/src/main/java/org/dspace/search/DSIndexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1067,33 +1067,9 @@ private static Document buildDocumentForItem(Item item) throws SQLException, IOE
mydc = item.getMetadata(indexConfigArr[i].schema, indexConfigArr[i].element, indexConfigArr[i].qualifier, Item.ANY);
}


//Index the controlled vocabularies display values. The stored values will be indexed in the next for loop
if ("controlledVocabulary".equalsIgnoreCase(indexConfigArr[i].type)){


List newValues=new ArrayList<String>();

//Get the display value of the respective stored value
newValues = org.dspace.app.util.Util.getControlledVocabulariesDisplayValue(item, mydc,indexConfigArr[i].schema, indexConfigArr[i].element, indexConfigArr[i].qualifier);

if (newValues!=null){
for (int m=0;m<newValues.size();m++){
if (!"".equals(newValues.get(m))){

String toAdd=(String) newValues.get(m);
doc.add( new Field(indexConfigArr[i].indexName,
toAdd,
Field.Store.YES,
Field.Index.ANALYZED));
}
}
}

}

//Index the controlled vocabularies localized display values for all localized input-forms.xml (e.g. input-forms_el.xml)
if ("controlledVocabularyLocalized".equalsIgnoreCase(indexConfigArr[i].type)){
if ("inputform".equalsIgnoreCase(indexConfigArr[i].type)){


List newValues=new ArrayList<String>();
Expand Down Expand Up @@ -1122,30 +1098,7 @@ private static Document buildDocumentForItem(Item item) throws SQLException, IOE

}

//Index the controlled vocabularies localized display values (message properties). The stored values will be indexed in the next for loop
if ("controlledVocabularyMultilingual".equalsIgnoreCase(indexConfigArr[i].type)){


List newValues=new ArrayList<String>();
Locale[] supportedLocales=I18nUtil.getSupportedLocales();
//Get the display value of the respective stored value
newValues = org.dspace.app.util.Util.getControlledVocabulariesMultilingualValues(item, mydc,indexConfigArr[i].schema, indexConfigArr[i].element, indexConfigArr[i].qualifier, supportedLocales);

if (newValues!=null){
for (int m=0;m<newValues.size();m++){
if (!"".equals(newValues.get(m))){

String toAdd=(String) newValues.get(m);

doc.add( new Field(indexConfigArr[i].indexName,
toAdd,
Field.Store.YES,
Field.Index.ANALYZED));
}
}
}

}

for (j = 0; j < mydc.length; j++)
{
if (!StringUtils.isEmpty(mydc[j].value))
Expand Down
10 changes: 3 additions & 7 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,10 @@ search.maxfieldlength = 10000

# DC metadata elements.qualifiers to be indexed for search
# format: - search.index.[number] = [search field]:element.qualifier
# - * used as wildcard
# - controlledVocabulary -> In case the field is submitted from a list from input forms. In this case the stored
# and the displayed value are indexed.If the stored value is not found in input-forms, it is indexed anyway.
# - controlledVocabularyLocalized -> In case we have different input-forms for different repository supported locales (e.g input-forms_el.xml, input-forms_pt.xml etc). In this case, the
# - * used as wildcard
# - inputform -> In case we have different input-forms for different repository supported locales (e.g input-forms_el.xml, input-forms_pt.xml etc). In this case, the
# stored and the displayed value from all input-forms are indexed. If the stored value is not found in input-forms, it is indexed anyway.
# - controlledVocabularyMultilingual -> In case the field is submitted from a multilingual list from input forms (message properties). Then the
# stored and the displayed value translated to all repository supported locales (from message properties) are indexed. If the stored value is not found in input-forms, it is indexed anyway.
# - * used as wildcard
# e.g.:search.index.12 = language:dc.language:inputform
#
### changing these will change your search results, ###
### but will NOT automatically change your search displays ###
Expand Down

0 comments on commit c31651b

Please sign in to comment.