Skip to content

Commit

Permalink
Refactors search
Browse files Browse the repository at this point in the history
Fix #1319 by refactoring search (details in the issue)
Fix #1274 by replacing parameter `aipId` with `parentId` in the Catalogue search, when the filter is being applied to a list of AIPs
  • Loading branch information
chalkos committed Aug 22, 2018
1 parent aff9f24 commit 0767f5f
Show file tree
Hide file tree
Showing 208 changed files with 4,171 additions and 5,333 deletions.
12 changes: 6 additions & 6 deletions documentation/Advanced_Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ To apply the changes on the stylesheet you must ingest new content or re-index e
Change your `roda-wui.properties` to [add an new advanced search field item](https://github.com/keeps/roda/blob/master/roda-ui/roda-wui/src/main/resources/config/roda-wui.properties#L165):

```javaproperties
ui.search.fields.items = destructiondate # add new field to the list of fields for items (i.e. AIPs), other options are representations or files
ui.search.fields.items.destructiondate.fields = destructiondate_txt # the id of the field in the index, equal to the one on the stylesheet you create
ui.search.fields.items.destructiondate.i18n = ui.search.fields.items.destructiondate # key for the translation in ServerMessages.properties
ui.search.fields.items.destructiondate.type = text # the type of the field which influences the search form input
ui.search.fields.items.destructiondate.fixed = true # if it appears on advanced search by default or if it needs to be added via the "ADD SEARCH FIELD" button.
ui.search.fields.IndexedAIP = destructiondate # add new field to the list of fields for items (i.e. AIPs), other options are representations or files
ui.search.fields.IndexedAIP.destructiondate.fields = destructiondate_txt # the id of the field in the index, equal to the one on the stylesheet you create
ui.search.fields.IndexedAIP.destructiondate.i18n = ui.search.fields.IndexedAIP.destructiondate # key for the translation in ServerMessages.properties
ui.search.fields.IndexedAIP.destructiondate.type = text # the type of the field which influences the search form input
ui.search.fields.IndexedAIP.destructiondate.fixed = true # if it appears on advanced search by default or if it needs to be added via the "ADD SEARCH FIELD" button.
```
You should also add the necessary translations to your `$RODA_HOME/config/i18n/ServerMessages.properties`, and in all languages you which to support.

Expand All @@ -77,5 +77,5 @@ ui.browse.metadata.descriptive.type.golikswe_1=Golik SWE (version 1)
Add [translations for your fields](https://github.com/keeps/roda/blob/master/roda-ui/roda-wui/src/main/resources/config/i18n/ServerMessages.properties#L2):

```javaproperties
ui.search.fields.items.destructiondate= Destruction Date
ui.search.fields.IndexedAIP.destructiondate= Destruction Date
```
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public enum DateGranularity {
public static final String UI_GOOGLE_RECAPTCHA_CODE_PROPERTY = "ui.google.recaptcha.code";

public static final String UI_LISTS_PROPERTY = "ui.lists";

public static final String UI_LISTS_FACETS_QUERY_PROPERTY = "facets.query";
public static final String UI_LISTS_FACETS_PARAMETERS_PROPERTY = "facets.parameters";
public static final String UI_LISTS_FACETS_PARAMETERS_TYPE_PROPERTY = "type";
Expand All @@ -109,6 +110,17 @@ public enum DateGranularity {
public static final String UI_LISTS_FACETS_PARAMETERS_ARGS_VALUES_PROPERTY = "values";
public static final String UI_LISTS_FACETS_PARAMETERS_ARGS_MINCOUNT_PROPERTY = "minCount";

public static final String UI_LISTS_SEARCH_ENABLED_PROPERTY = "search.enabled";
public static final String UI_LISTS_SEARCH_PREFILTERS_VISIBLE_PROPERTY = "search.prefilters.visible";
public static final String UI_LISTS_SEARCH_ADVANCED_ENABLED_PROPERTY = "search.advanced.enabled";
public static final String UI_LISTS_SEARCH_SELECTEDINFO_ALWAYSVISIBLE_PROPERTY = "search.selectedInfo.alwaysVisible";
public static final String UI_LISTS_SEARCH_SELECTEDINFO_ICON_PROPERTY = "search.selectedInfo.icon";
public static final String UI_LISTS_SEARCH_SELECTEDINFO_LABEL_SELECTED_I18N_SINGLE_PROPERTY = "search.selectedInfo.label.selected.i18n.single";
public static final String UI_LISTS_SEARCH_SELECTEDINFO_LABEL_SELECTED_I18N_MULTIPLE_PROPERTY = "search.selectedInfo.label.selected.i18n.multiple";
public static final String UI_LISTS_SEARCH_SELECTEDINFO_LABEL_DEFAULT_I18N_PROPERTY = "search.selectedInfo.label.default.i18n";

public static final String UI_ICONS_CLASS = "ui.icons.class";

/*
* RODA objects
*/
Expand Down Expand Up @@ -580,6 +592,8 @@ public enum OrchestratorType {
public static final String INDEX_UUID = "uuid";
public static final String INDEX_ID = "id";
public static final String INDEX_STATE = "state";
public static final String INDEX_SEARCH = "search";
public static final String INDEX_WILDCARD = "*";

/*
* AIP FIELDS
Expand Down Expand Up @@ -625,6 +639,8 @@ public enum OrchestratorType {
public static final String AIP_UPDATED_ON = "updatedOn";
public static final String AIP_UPDATED_BY = "updatedBy";

// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String AIP_SEARCH = "search";

// AIP types
Expand Down Expand Up @@ -657,6 +673,8 @@ public enum OrchestratorType {
public static final String REPRESENTATION_UPDATED_BY = "updatedBy";

public static final String REPRESENTATION_STATES = "representationStates";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String REPRESENTATION_SEARCH = "search";

// Representation types
Expand Down Expand Up @@ -733,6 +751,8 @@ public enum OrchestratorType {
public static final String LOG_PARAMETERS = "parameters";
public static final String LOG_STATE = "state";
public static final String LOG_FILE_ID = "fileID";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String LOG_SEARCH = "search";

// MEMBER: USER or GROUP
Expand All @@ -745,6 +765,8 @@ public enum OrchestratorType {
public static final String MEMBERS_USERS = "users";
public static final String MEMBERS_ROLES_DIRECT = "rolesDirect";
public static final String MEMBERS_ROLES_ALL = "rolesAll";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String MEMBERS_SEARCH = "search";
public static final String MEMBERS_EMAIL = "email";

Expand All @@ -759,6 +781,8 @@ public enum OrchestratorType {
public static final String TRANSFERRED_RESOURCE_SIZE = "size";
public static final String TRANSFERRED_RESOURCE_ANCESTORS = "ancestors";
public static final String TRANSFERRED_RESOURCE_LAST_SCAN_DATE = "lastScanDate";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String TRANSFERRED_RESOURCE_SEARCH = "search";
// REST
public static final String TRANSFERRED_RESOURCE_DIRECTORY_NAME = "name";
Expand Down Expand Up @@ -790,6 +814,8 @@ public enum OrchestratorType {
public static final String JOB_HAS_FAILURES = "hasFailures";
public static final String JOB_FILE_EXTENSION = ".json";

// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String JOB_SEARCH = "search";

/* Plugins related parameters */
Expand Down Expand Up @@ -916,6 +942,8 @@ public enum OrchestratorType {
public static final String JOB_REPORT_UNSUCCESSFUL_PLUGINS = "unsuccessfulPlugins";
public static final String JOB_REPORT_UNSUCCESSFUL_PLUGINS_COUNTER = "unsuccessfulPluginsCounter";
public static final String JOB_REPORT_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String JOB_REPORT_SEARCH = "search";

public static final String FILE_PATH = "path";
Expand Down Expand Up @@ -944,6 +972,8 @@ public enum OrchestratorType {
public static final String FILE_FULLTEXT = "fulltext";
public static final String FILE_ANCESTORS = "ancestors";
public static final String FILE_FORMAT_DESIGNATION = "formatDesignation";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String FILE_SEARCH = "search";

/* Risks */
Expand Down Expand Up @@ -983,6 +1013,8 @@ public enum OrchestratorType {
public static final String RISK_UPDATED_BY = "updatedBy";

public static final String RISK_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String RISK_SEARCH = "search";

public static final String RISK_INCIDENCE_ID = "id";
Expand All @@ -1006,6 +1038,8 @@ public enum OrchestratorType {
public static final String RISK_INCIDENCE_FILE_PATH_COMPUTED = "filePathComputed";
public static final String RISK_INCIDENCE_FILE_PATH_COMPUTED_SEPARATOR = "/";
public static final String RISK_INCIDENCE_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String RISK_INCIDENCE_SEARCH = "search";

/* Representation information */
Expand All @@ -1032,6 +1066,8 @@ public enum OrchestratorType {
public static final String REPRESENTATION_INFORMATION_UPDATED_BY = "updatedBy";

public static final String REPRESENTATION_INFORMATION_FILE_EXTENSION = ".xml";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String REPRESENTATION_INFORMATION_SEARCH = "search";

public static final String ONE_OF_FORMAT_FIELDS = "oneOfFormatFields";
Expand Down Expand Up @@ -1059,6 +1095,8 @@ public enum OrchestratorType {
public static final String FORMAT_VERSIONS = "versions";

public static final String FORMAT_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String FORMAT_SEARCH = "search";

/* Notifications */
Expand All @@ -1074,6 +1112,8 @@ public enum OrchestratorType {
public static final String NOTIFICATION_STATE = "state";

public static final String NOTIFICATION_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String NOTIFICATION_SEARCH = "search";
public static final String NOTIFICATION_VARIOUS_RECIPIENT_USERS = "various-recipient-users";

Expand Down Expand Up @@ -1103,6 +1143,8 @@ public enum OrchestratorType {
public static final String DIP_ALL_REPRESENTATION_UUIDS = "allRepresentationUUIDs";

public static final String DIP_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String DIP_SEARCH = "search";

public static final String DIPFILE_ID = "id";
Expand All @@ -1121,6 +1163,8 @@ public enum OrchestratorType {
public static final String DIPFILE_FORMAT_EXTENSION = "formatExtension";

public static final String DIPFILE_FILE_EXTENSION = ".json";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String DIPFILE_SEARCH = "search";

/* View representation */
Expand Down Expand Up @@ -1155,6 +1199,8 @@ public enum OrchestratorType {
public static final String PRESERVATION_EVENT_LINKING_AGENT_IDENTIFIER = "linkingAgentIdentifier";
public static final String PRESERVATION_EVENT_LINKING_OUTCOME_OBJECT_IDENTIFIER = "linkingOutcomeObjectIdentifier";
public static final String PRESERVATION_EVENT_LINKING_SOURCE_OBJECT_IDENTIFIER = "linkingSourceObjectIdentifier";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String PRESERVATION_EVENT_SEARCH = "search";

/* Preservation agents fields */
Expand All @@ -1165,6 +1211,8 @@ public enum OrchestratorType {
public static final String PRESERVATION_AGENT_VERSION = "version";
public static final String PRESERVATION_AGENT_NOTE = "note";
public static final String PRESERVATION_AGENT_ROLES = "roles";
// @deprecated use {@link #INDEX_SEARCH} instead.
@Deprecated()
public static final String PRESERVATION_AGENT_SEARCH = "search";

public static final String PRESERVATION_TYPE_AGENT = "agent";
Expand Down Expand Up @@ -1317,8 +1365,6 @@ public String toString() {
public static final String SEARCH_FIELD_TYPE_SUGGEST_PARTIAL = "suggestPartial";
public static final String SEARCH_FIELD_TYPE_CONTROLLED = "controlled";

public static final String SEARCH_BUTTON_EVENT_MARK = "do_search";

public static final String METADATA_VERSION_SEPARATOR = "_";
public static final String METADATA_TEMPLATE_FOLDER = "templates";
public static final String METADATA_TEMPLATE_EXTENSION = ".xml.hbs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public List<Field> getFields() {
.setDefaultValue(AIPState.getDefault().toString()));
}

ret.add(SolrCollection.getSearchField());

return ret;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.apache.solr.client.solrj.request.schema.SchemaRequest.AddField;
import org.apache.solr.client.solrj.request.schema.SchemaRequest.Update;
import org.roda.core.data.common.RodaConstants;

public class Field {

Expand All @@ -25,7 +26,7 @@ public class Field {
public static final String TYPE_DATE = "pdate";
public static final String TYPE_STRING = "string";

public static final String FIELD_SEARCH = "search";
public static final String FIELD_SEARCH = RodaConstants.INDEX_SEARCH;
public static final String TYPE_SEARCH = TYPE_TEXT;

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
import org.roda.core.data.common.RodaConstants;
import org.roda.core.data.exceptions.AuthorizationDeniedException;
import org.roda.core.data.exceptions.GenericException;
import org.roda.core.data.exceptions.NotFoundException;
Expand All @@ -26,7 +27,7 @@ static Field getSearchField() {
}

static CopyField getCopyAllToSearchField() {
return new CopyField("*", Field.FIELD_SEARCH);
return new CopyField(RodaConstants.INDEX_WILDCARD, Field.FIELD_SEARCH);
}

static Field getSortFieldOf(String field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.AIP_DATE_FINAL, Field.TYPE_DATE));

fields.add(SolrCollection.getSortFieldOf(RodaConstants.AIP_TITLE));
fields.add(SolrCollection.getSearchField());

return fields;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ public List<Field> getFields() {
fields.add(
new Field(RodaConstants.DIP_ALL_REPRESENTATION_UUIDS, Field.TYPE_STRING).setStored(false).setMultiValued(true));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.roda.core.index.schema.AbstractSolrCollection;
import org.roda.core.index.schema.CopyField;
import org.roda.core.index.schema.Field;
import org.roda.core.index.schema.SolrCollection;
import org.roda.core.index.utils.SolrUtils;
import org.roda.core.model.utils.ModelUtils;
import org.roda.core.util.IdUtils;
Expand Down Expand Up @@ -66,7 +65,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.DIPFILE_SIZE, Field.TYPE_LONG).setRequired(true));
fields.add(new Field(RodaConstants.DIPFILE_STORAGE_PATH, Field.TYPE_STRING));

fields.add(SolrCollection.getSearchField());
return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.roda.core.index.schema.AbstractSolrCollection;
import org.roda.core.index.schema.CopyField;
import org.roda.core.index.schema.Field;
import org.roda.core.index.schema.SolrCollection;
import org.roda.core.index.utils.SolrUtils;
import org.roda.core.model.utils.ModelUtils;
import org.roda.core.storage.Binary;
Expand Down Expand Up @@ -100,8 +99,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.INGEST_JOB_ID, Field.TYPE_STRING));
fields.add(new Field(RodaConstants.INGEST_UPDATE_JOB_IDS, Field.TYPE_STRING).setMultiValued(true));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.FORMAT_ALTERNATIVE_DESIGNATIONS, Field.TYPE_STRING).setMultiValued(true));
fields.add(new Field(RodaConstants.FORMAT_VERSIONS, Field.TYPE_STRING).setMultiValued(true));

fields.add(SolrCollection.getSearchField());
fields.add(SolrCollection.getSortFieldOf(RodaConstants.FORMAT_NAME));

return fields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.JOB_OUTCOME_OBJECTS_WITH_MANUAL_INTERVENTION, Field.TYPE_INT));
fields.add(new Field(RodaConstants.JOB_HAS_FAILURES, Field.TYPE_BOOLEAN).setStored(false));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.JOB_REPORT_UNSUCCESSFUL_PLUGINS, Field.TYPE_STRING).setMultiValued(true).setStored(false));
fields.add(new Field(RodaConstants.JOB_REPORT_UNSUCCESSFUL_PLUGINS_COUNTER, Field.TYPE_INT).setStored(false));

fields.add(SolrCollection.getSearchField());
return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.LOG_STATE, Field.TYPE_STRING).setRequired(true));
fields.add(new Field(RodaConstants.LOG_PARAMETERS, Field.TYPE_STRING).setIndexed(false));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.MEMBERS_FULLNAME, Field.TYPE_STRING));
fields.add(new Field(RodaConstants.MEMBERS_EMAIL, Field.TYPE_STRING));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.NOTIFICATION_STATE, Field.TYPE_STRING).setRequired(true));
fields.add(new Field(RodaConstants.NOTIFICATION_ACKNOWLEDGED_USERS, Field.TYPE_STRING).setIndexed(false));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.PRESERVATION_AGENT_NOTE, Field.TYPE_STRING));
fields.add(new Field(RodaConstants.PRESERVATION_AGENT_VERSION, Field.TYPE_STRING));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
import org.roda.core.data.exceptions.NotFoundException;
import org.roda.core.data.exceptions.RequestNotValidException;
import org.roda.core.data.utils.JsonUtils;
import org.roda.core.data.utils.URNUtils;
import org.roda.core.data.v2.ip.metadata.IndexedPreservationEvent;
import org.roda.core.data.v2.ip.metadata.IndexedPreservationEvent.PreservationMetadataEventClass;
import org.roda.core.data.v2.ip.metadata.LinkingIdentifier;
import org.roda.core.data.v2.ip.metadata.PreservationMetadata;
import org.roda.core.data.v2.ip.metadata.PreservationMetadata.PreservationMetadataType;
import org.roda.core.data.v2.validation.ValidationException;
import org.roda.core.index.schema.AbstractSolrCollection;
import org.roda.core.index.schema.CopyField;
Expand Down Expand Up @@ -87,8 +85,6 @@ public List<Field> getFields() {
fields.add(new Field(RodaConstants.PRESERVATION_EVENT_LINKING_SOURCE_OBJECT_IDENTIFIER, Field.TYPE_STRING)
.setMultiValued(true));

fields.add(SolrCollection.getSearchField());

return fields;
}

Expand Down
Loading

0 comments on commit 0767f5f

Please sign in to comment.