Skip to content

Commit

Permalink
finalize new tag and access Solr field names #2466 #2455
Browse files Browse the repository at this point in the history
Also print errors like this: undefined field: "fileTag"
  • Loading branch information
pdurbin committed Sep 8, 2015
1 parent 24a9eba commit c7a288b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions conf/solr/4.6.0/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@

<field name="fileTypeGroupFacet" type="string" stored="true" indexed="true" multiValued="false"/>
<field name="fileTypeDisplay" type="string" stored="true" indexed="true" multiValued="false"/>
<field name="fileTag" type="string" stored="true" indexed="true" multiValued="true"/>
<field name="fileTags" type="text_en" stored="true" indexed="true" multiValued="true"/>
<field name="fileAccess" type="string" stored="true" indexed="true" multiValued="true"/>

<!-- Added for Dataverse 4.0 alpha 1: static "parent" fields not copied to "catchall" field https://redmine.hmdc.harvard.edu/issues/3603 -->
<!-- We index parentid and parentname as a debugging aid in case we want to match on it with an explict query like curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=parentid%3A42' or curl 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=parentname%3Abirds' -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ private String addOrUpdateDataset(IndexableDataset indexableDataset) {
}
for (String tag : fileMetadata.getCategoriesByName()) {
datafileSolrInputDocument.addField(SearchFields.FILE_TAG, tag);
datafileSolrInputDocument.addField(SearchFields.FILE_TAG_SEARCHABLE, tag);
}
}
datafileSolrInputDocument.addField(SearchFields.NAME, filenameCompleteFinal);
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/search/SearchFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ public class SearchFields {
public static final String FILE_SIZE_IN_BYTES = "fileSizeInBytes";
public static final String FILE_MD5 = "fileMd5";
public static final String FILENAME_WITHOUT_EXTENSION = "fileNameWithoutExtension";
public static final String FILE_TAG = "fileTags_ss";
public static final String ACCESS = "fileRestricted_s";
/**
* Indexed as a string so we can facet on it.
*/
public static final String FILE_TAG = "fileTag";
/**
* Indexed as text_en so it's searchable by lower case etc.
*/
public static final String FILE_TAG_SEARCHABLE = "fileTags";
public static final String ACCESS = "fileAccess";

public static final String SUBTREE = "subtreePaths";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public SolrQueryResponse search(User user, Dataverse dataverse, String query, Li
* https://redmine.hmdc.harvard.edu/issues/3848
*/
solrFieldsToHightlightOnMap.put(SearchFields.FILENAME_WITHOUT_EXTENSION, "Filename Without Extension");
solrFieldsToHightlightOnMap.put(SearchFields.FILE_TAG_SEARCHABLE, "File Tag");
List<DatasetFieldType> datasetFields = datasetFieldService.findAllOrderedById();
for (DatasetFieldType datasetFieldType : datasetFields) {
String solrField = datasetFieldType.getSolrField().getNameSearchable();
Expand Down Expand Up @@ -272,7 +273,7 @@ public SolrQueryResponse search(User user, Dataverse dataverse, String query, Li
} else {
error += messageFromSolr;
}
logger.fine(error);
logger.info(error);
SolrQueryResponse exceptionSolrQueryResponse = new SolrQueryResponse(solrQuery);
exceptionSolrQueryResponse.setError(error);

Expand Down

0 comments on commit c7a288b

Please sign in to comment.