5959import java .time .format .DateTimeFormatter ;
6060import java .time .format .DateTimeParseException ;
6161import java .util .ArrayList ;
62-
62+ import java . util . Arrays ;
6363import java .util .Calendar ;
6464import java .util .Collection ;
6565import java .util .Date ;
8585import jakarta .ejb .EJBException ;
8686import jakarta .ejb .Stateless ;
8787import jakarta .ejb .TransactionAttribute ;
88+
89+ import static edu .harvard .iq .dataverse .DatasetField .NA_VALUE ;
8890import static jakarta .ejb .TransactionAttributeType .REQUIRES_NEW ;
8991
9092import jakarta .inject .Inject ;
@@ -235,7 +237,7 @@ public Future<String> indexDataverse(Dataverse dataverse, boolean processPaths)
235237 solrInputDocument .addField (SearchFields .RELEASE_OR_CREATE_DATE , dataverse .getCreateDate ());
236238 }
237239
238- /* We don't really have harvested dataverses yet;
240+ /* We don't really have harvested dataverses yet;
239241 (I have in fact just removed the isHarvested() method from the Dataverse object) -- L.A.
240242 if (dataverse.isHarvested()) {
241243 solrInputDocument.addField(SearchFields.IS_HARVESTED, true);
@@ -265,7 +267,7 @@ public Future<String> indexDataverse(Dataverse dataverse, boolean processPaths)
265267 Set <String > langs = settingsService .getConfiguredLanguages ();
266268 for (ControlledVocabularyValue dataverseSubject : dataverse .getDataverseSubjects ()) {
267269 String subject = dataverseSubject .getStrValue ();
268- if (!subject .equals (DatasetField . NA_VALUE )) {
270+ if (!subject .equals (NA_VALUE )) {
269271 // Index in all used languages (display and metadata languages
270272 for (String locale : langs ) {
271273 solrInputDocument .addField (SearchFields .DATAVERSE_SUBJECT , dataverseSubject .getLocaleStrValue (locale ));
@@ -1060,7 +1062,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
10601062 if (datasetVersion .isInReview ()) {
10611063 solrInputDocument .addField (SearchFields .PUBLICATION_STATUS , IN_REVIEW_STRING );
10621064 }
1063-
1065+
10641066 CurationStatus status = datasetVersion .getCurrentCurationStatus ();
10651067 if (status != null && Strings .isNotBlank (status .getLabel ())) {
10661068 solrInputDocument .addField (SearchFields .CURATION_STATUS , status .getLabel ());
@@ -1258,7 +1260,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
12581260 */
12591261 if (dsf .getControlledVocabularyValues ().isEmpty ()) {
12601262 for (DatasetFieldValue dfv : dsf .getDatasetFieldValues ()) {
1261- if (dfv .getValue () == null || dfv .getValue ().equals (DatasetField . NA_VALUE )) {
1263+ if (dfv .getValue () == null || dfv .getValue ().equals (NA_VALUE )) {
12621264 continue ;
12631265 }
12641266 solrInputDocument .addField (solrFieldSearchable , dfv .getValue ());
@@ -1269,7 +1271,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
12691271 }
12701272 } else {
12711273 for (ControlledVocabularyValue controlledVocabularyValue : dsf .getControlledVocabularyValues ()) {
1272- if (controlledVocabularyValue .getStrValue ().equals (DatasetField . NA_VALUE )) {
1274+ if (controlledVocabularyValue .getStrValue ().equals (NA_VALUE )) {
12731275 continue ;
12741276 }
12751277
@@ -1305,7 +1307,9 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
13051307 solrInputDocument .addField (solrFieldFacetable , topicClassificationTerm );
13061308 }
13071309 } else {
1308- solrInputDocument .addField (solrFieldFacetable , dsf .getValuesWithoutNaValues ());
1310+ var values = dsf .getDisplayValues (); // for proper display of facets with '
1311+ values .removeAll (Arrays .asList (NA_VALUE ));
1312+ solrInputDocument .addField (solrFieldFacetable , values );
13091313 }
13101314 }
13111315 }
@@ -1722,7 +1726,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
17221726 GlobalId filePid = datafile .getGlobalId ();
17231727 datafileSolrInputDocument .addField (SearchFields .FILE_PERSISTENT_ID ,
17241728 (filePid != null ) ? filePid .toString () : null );
1725-
1729+
17261730 datafileSolrInputDocument .addField (SearchFields .SUBTREE , dataversePaths );
17271731 // datafileSolrInputDocument.addField(SearchFields.HOST_DATAVERSE,
17281732 // dataFile.getOwner().getOwner().getName());
@@ -1743,7 +1747,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
17431747 datafileSolrInputDocument .addField (SearchFields .VARIABLE_COUNT , variables .size ());
17441748 datafileSolrInputDocument .addField (SearchFields .OBSERVATIONS , observations );
17451749 datafileSolrInputDocument .addField (SearchFields .UNF , dtable .getUnf ());
1746-
1750+
17471751
17481752 Map <Long , VariableMetadata > variableMap = null ;
17491753 Collection <VariableMetadata > variablesByMetadata = fileMetadata .getVariableMetadatas ();
0 commit comments