Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Filter files by File Path (directoryLabel) #10874

Open
stevenferey opened this issue Sep 24, 2024 · 4 comments
Open

Feature Request: Filter files by File Path (directoryLabel) #10874

stevenferey opened this issue Sep 24, 2024 · 4 comments
Labels
Type: Feature a feature request

Comments

@stevenferey
Copy link
Contributor

Hello Dataverse team,

To facilitate file searching in large datasets, allow filtering of files by Tag and File Path :

Here is a mockup of a possible result for the filter list:
Capture d’écran du 2024-09-24 14-43-15

Best regards,

@stevenferey stevenferey added the Type: Feature a feature request label Sep 24, 2024
@qqmyers
Copy link
Member

qqmyers commented Sep 24, 2024

FWIW: Dataverse can already sort by folder and tag if desired - see https://guides.dataverse.org/en/latest/installation/config.html#categoryorder, https://guides.dataverse.org/en/latest/installation/config.html#orderbyfolder, and https://guides.dataverse.org/en/latest/installation/config.html#allowusermanagementoforder.

These are 'pre-sort' options in that you can still sort alphabetically, by date, etc. within these sections. QDR uses this to put Documentation files at the start of each dataset's files and to group files by folder. (QDR doesn't allow the user to flip this pre-sorting on/off which is what the last setting allows.)

@pdurbin
Copy link
Member

pdurbin commented Sep 26, 2024

Yes, good idea to add File Path (directoryLabel in the code). From a quick look, we don't index it at all. 🤔

As for File Tag, it's already there in both the old UI and the new UI:

Screenshot 2024-09-26 at 1 40 51 PM

Screenshot 2024-09-26 at 1 40 59 PM

... unless I'm missing something. 🙃

@stevenferey
Copy link
Contributor Author

Of course, It works for me! I change the issue title to only mention the file path.

I think I didn't see because when you add more than 10 files in a datadset, in return, no filter is available in the interface :

Capture d’écran du 2024-09-27 17-09-32

After reloading the page, the filters are displayed correctly :

Capture d’écran du 2024-09-27 17-15-44

The display bug is not present on the new UI !

@stevenferey stevenferey changed the title Feature Request: Filter files by Tag and File Path Feature Request: Filter files by File Path (directoryLabel) Sep 27, 2024
@pdurbin
Copy link
Member

pdurbin commented Sep 27, 2024

@stevenferey thanks for updating the title. Are you thinking about making a pull request. I imagine the diff would start with something like this (completely untested):

diff --git a/conf/solr/schema.xml b/conf/solr/schema.xml
index 2aed50e999..1d90da4928 100644
--- a/conf/solr/schema.xml
+++ b/conf/solr/schema.xml
@@ -163,6 +163,7 @@
     <field name="subtreePaths" type="string" stored="true" indexed="true" multiValued="true"/>
 
     <field name="fileName" type="text_en" stored="true" indexed="true" multiValued="true"/>
+    <field name="filePath" type="string" stored="true" indexed="true" multiValued="false"/>
     <field name="fileType" type="text_en" stored="true" indexed="true" multiValued="true"/>
     <field name="fileNameWithoutExtension" type="text_en" stored="true" indexed="true" multiValued="true"/>
     <field name="variableName" type="text_en" stored="true" indexed="true" multiValued="true"/>
diff --git a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java
index a8cf9ed519..dde8837634 100644
--- a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java
+++ b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java
@@ -1435,6 +1435,8 @@ public class IndexServiceBean {
                     if (fileMetadata != null) {
                         String filenameComplete = fileMetadata.getLabel();
                         if (filenameComplete != null) {
+                            String filePath = fileMetadata.getDirectoryLabel();
+                            datafileSolrInputDocument.addField(SearchFields.FILE_PATH, filePath);
                             String filenameWithoutExtension = "";
                             // String extension = "";
                             int i = filenameComplete.lastIndexOf('.');
diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchFields.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchFields.java
index ef27a5eefa..f18d539d0c 100644
--- a/src/main/java/edu/harvard/iq/dataverse/search/SearchFields.java
+++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchFields.java
@@ -146,6 +146,7 @@ public class SearchFields {
      */
     public static final String AFFILIATION = "affiliation_ss";
     public static final String FILE_NAME = "fileName";
+    public static final String FILE_PATH = "filePath";
     public static final String FILE_DESCRIPTION = "fileDescription";
     public static final String FILE_PERSISTENT_ID = "filePersistentId";
     /**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature a feature request
Projects
None yet
Development

No branches or pull requests

3 participants