Skip to content

Commit

Permalink
start hiding drafts after version 1.0 from public #3795
Browse files Browse the repository at this point in the history
- introduced possibility multiple Solr documents per dataset
  • Loading branch information
pdurbin committed Apr 16, 2014
1 parent 775d5d4 commit aad5c01
Show file tree
Hide file tree
Showing 19 changed files with 412 additions and 87 deletions.
1 change: 1 addition & 0 deletions scripts/database/homebrew/rebuild-and-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/Applications/NetBeans/glassfish4/glassfish/bin/asadmin stop-domain
scripts/database/homebrew/drop-database
scripts/search/clear
rm -rf ~/dataverse/files
scripts/database/homebrew/create-database
mvn package
/Applications/NetBeans/glassfish4/glassfish/bin/asadmin start-domain
Expand Down
6 changes: 4 additions & 2 deletions scripts/search/tests/dataset-versioning01
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
# We assume you've done everything in scripts/search/tests/highlighting
# and you have an unreleased dataset and file
diff <(curl -s 'http://localhost:8080/api/datasets/17/versions/1?key=pete') scripts/search/tests/expected/dataset-versioning01raw
#diff <(curl -s 'http://localhost:8080/api/datasets/17/versions/1?key=pete') scripts/search/tests/expected/dataset-versioning01raw
# nick can see the dataset and file
diff <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&key=nick') scripts/search/tests/expected/highlighting-nick-trees
# pete can see the dataset and file
diff <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&key=pete') scripts/search/tests/expected/highlighting-pete-trees
# anon can't see the dataset and file
diff <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning01anon
# here's the solr doc for the dataset
diff <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') scripts/search/tests/expected/dataset-versioning01dataset_17solr
#diff <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') scripts/search/tests/expected/dataset-versioning01dataset_17solr
4 changes: 2 additions & 2 deletions scripts/search/tests/dataset-versioning02
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
# We assume you just released your dataset for the first time.
# raw version
diff <(curl -s 'http://localhost:8080/api/datasets/17/versions/1?key=pete') scripts/search/tests/expected/dataset-versioning02raw
#diff <(curl -s 'http://localhost:8080/api/datasets/17/versions/1?key=pete') scripts/search/tests/expected/dataset-versioning02raw
# anon can now see the dataset and file
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
# here's the solr doc for the dataset
diff -u scripts/search/tests/expected/dataset-versioning02dataset_17solr <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') | egrep -v '_version_|release_or_create_date_dt'
#diff -u scripts/search/tests/expected/dataset-versioning02dataset_17solr <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') | egrep -v '_version_|release_or_create_date_dt'
10 changes: 6 additions & 4 deletions scripts/search/tests/dataset-versioning03
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
# Title: Rings of Conifers and Other Observations
#
# anon should be able to see the published 1.0 version but not the new draft (no change from dataset-versioning02anon)
#diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
# pete should be able to see the published version 1.0 with published=true (same as anon)
#diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&published=true') scripts/search/tests/expected/dataset-versioning02anon
# pete should be able to see the newer draft version with published=false
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&published=false') scripts/search/tests/expected/dataset-versioning03pete
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete&published=true') scripts/search/tests/expected/dataset-versioning03pete-published-only
# pete should be able to see the newer draft version with unpublished=true
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete&unpublished=true') scripts/search/tests/expected/dataset-versioning03pete-unpublished-only
# pete should be able to see both published and unpublished by not specifying either
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete') scripts/search/tests/expected/dataset-versioning03pete-both
# here's the solr doc for the dataset
#diff -u scripts/search/tests/expected/dataset-versioning02dataset_17solr <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') | egrep -v '_version_|release_or_create_date_dt'
12 changes: 12 additions & 0 deletions scripts/search/tests/expected/dataset-versioning01anon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

{
"q":"trees",
"fq_provided":"[]",
"fq_actual":"[{!join from=groups_s to=perms_ss}id:group_public]",
"total_count":0,
"start":0,
"count_in_response":0,
"items":"[]",
"relevance":[
]
}
64 changes: 64 additions & 0 deletions scripts/search/tests/expected/dataset-versioning02anon
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

{
"q":"trees",
"fq_provided":"[]",
"fq_actual":"[{!join from=groups_s to=perms_ss}id:group_public]",
"total_count":2,
"start":0,
"count_in_response":2,
"items":"[datafile_18:trees.png:18, dataset_17:Rings of Trees and Other Observations:17]",
"relevance":[
{
"id":"datafile_18",
"matched_fields":"[description]",
"detailsArray":[
{
"description":[
"<span class=\"search-term-match\">Trees</span> are lovely."
]
}
]
},
{
"id":"dataset_17",
"matched_fields":"[title, citation_t, description, notesText, authorAffiliation, keyword, contributorName]",
"detailsArray":[
{
"title":[
"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations"
]
},
{
"citation_t":[
"Tree, Tony, 2014, \"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations\", http://dx.doi.org/10.5072/FK2/17, Root"
]
},
{
"description":[
"<span class=\"search-term-match\">Trees</span> have rings. <span class=\"search-term-match\">Trees</span> can be tall."
]
},
{
"notesText":[
"Many notes have been taken about <span class=\"search-term-match\">trees</span> over the years."
]
},
{
"authorAffiliation":[
"<span class=\"search-term-match\">Trees</span> Inc."
]
},
{
"keyword":[
"<span class=\"search-term-match\">trees</span>"
]
},
{
"contributorName":[
"Edward <span class=\"search-term-match\">Trees</span> Jr."
]
}
]
}
]
}
10 changes: 10 additions & 0 deletions scripts/search/tests/expected/dataset-versioning03pete-both
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{
"q":"trees",
"fq_provided":"[]",
"fq_actual":"[({!join from=groups_s to=perms_ss}id:group_public OR {!join from=groups_s to=perms_ss}id:group_user1)]",
"total_count":6,
"start":0,
"count_in_response":6,
"items":"[datafile_18:trees.png:18, dataset_17:Rings of Trees and Other Observations:17, dataset_17_draft:Rings of Conifers and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{
"q":"trees",
"fq_provided":"[published_s:Published]",
"fq_actual":"[published_s:Published, ({!join from=groups_s to=perms_ss}id:group_public OR {!join from=groups_s to=perms_ss}id:group_user1)]",
"total_count":2,
"start":0,
"count_in_response":2,
"items":"[datafile_18:trees.png:18, dataset_17:Rings of Trees and Other Observations:17]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{
"q":"trees",
"fq_provided":"[published_s:Unpublished]",
"fq_actual":"[published_s:Unpublished, ({!join from=groups_s to=perms_ss}id:group_public OR {!join from=groups_s to=perms_ss}id:group_user1)]",
"total_count":4,
"start":0,
"count_in_response":4,
"items":"[dataset_17_draft:Rings of Conifers and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]"
}
4 changes: 2 additions & 2 deletions scripts/search/tests/expected/highlighting-nick-trees
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"total_count":5,
"start":0,
"count_in_response":5,
"items":"[datafile_18:trees.png:18, dataset_17:Rings of Trees and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]",
"items":"[datafile_18:trees.png:18, dataset_17_draft:Rings of Trees and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]",
"relevance":[
{
"id":"datafile_18",
Expand All @@ -20,7 +20,7 @@
]
},
{
"id":"dataset_17",
"id":"dataset_17_draft",
"matched_fields":"[title, citation_t, description, notesText, authorAffiliation, keyword, contributorName]",
"detailsArray":[
{
Expand Down
102 changes: 102 additions & 0 deletions scripts/search/tests/expected/highlighting-pete-trees
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

{
"q":"trees",
"fq_provided":"[]",
"fq_actual":"[({!join from=groups_s to=perms_ss}id:group_public OR {!join from=groups_s to=perms_ss}id:group_user1)]",
"total_count":5,
"start":0,
"count_in_response":5,
"items":"[datafile_18:trees.png:18, dataset_17_draft:Rings of Trees and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]",
"relevance":[
{
"id":"datafile_18",
"matched_fields":"[description]",
"detailsArray":[
{
"description":[
"<span class=\"search-term-match\">Trees</span> are lovely."
]
}
]
},
{
"id":"dataset_17_draft",
"matched_fields":"[title, citation_t, description, notesText, authorAffiliation, keyword, contributorName]",
"detailsArray":[
{
"title":[
"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations"
]
},
{
"citation_t":[
"Tree, Tony, <2014>, \"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations\", http://dx.doi.org/10.5072/FK2/17"
]
},
{
"description":[
"<span class=\"search-term-match\">Trees</span> have rings. <span class=\"search-term-match\">Trees</span> can be tall."
]
},
{
"notesText":[
"Many notes have been taken about <span class=\"search-term-match\">trees</span> over the years."
]
},
{
"authorAffiliation":[
"<span class=\"search-term-match\">Trees</span> Inc."
]
},
{
"keyword":[
"<span class=\"search-term-match\">trees</span>"
]
},
{
"contributorName":[
"Edward <span class=\"search-term-match\">Trees</span> Jr."
]
}
]
},
{
"id":"dataverse_10",
"matched_fields":"[description]",
"detailsArray":[
{
"description":[
"A bird dataverse with some <span class=\"search-term-match\">trees</span>"
]
}
]
},
{
"id":"dataverse_11",
"matched_fields":"[name]",
"detailsArray":[
{
"name":[
"<span class=\"search-term-match\">Trees</span>"
]
}
]
},
{
"id":"dataverse_16",
"matched_fields":"[description, name]",
"detailsArray":[
{
"description":[
"A dataverse with chestnut <span class=\"search-term-match\">trees</span> and an oriole"
]
},
{
"name":[
"Chestnut <span class=\"search-term-match\">Trees</span>"
]
}
]
}
]
}
6 changes: 5 additions & 1 deletion scripts/search/tests/highlighting
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@
#
# We assume you add a file called "trees.png" to this dataset
# with a description of "Trees are lovely."
diff <(curl -s 'http://localhost:8080/api/search?key=nick&q=trees&showrelevance=true') scripts/search/tests/expected/highlighting-nick-trees
#
# Then run an "index all" until this is fixed: https://redmine.hmdc.harvard.edu/issues/3809
# curl http://localhost:8080/api/index
diff <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&key=nick') scripts/search/tests/expected/highlighting-nick-trees
diff <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true&key=pete') scripts/search/tests/expected/highlighting-pete-trees
Loading

0 comments on commit aad5c01

Please sign in to comment.