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

ISSUE-305: Don't use parent_top_sequence_id if the result Node is the same as the c… #306

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,13 @@ protected function flavorfromSolrIndex(string $term, int $nodeid, string $proces
) > 0) {
foreach ($results as $result) {
$extradata_from_item = $result->getAllExtraData() ?? [];
// check if the hit was generated at the same node level of the caller, if so
// it is not of a CWS child (in terms of from where we are searching from)
// and no fictious offset should be happening at all.
$result_is_top_media = isset($allfields_translated_to_solr['parent_id']) ? $extradata_from_item['search_api_solr_document'][$allfields_translated_to_solr['parent_id']] == $nodeid : FALSE;

if (isset($allfields_translated_to_solr['parent_sequence_id']) &&
isset($extradata_from_item['search_api_solr_document'][$allfields_translated_to_solr['parent_sequence_id']])) {
isset($extradata_from_item['search_api_solr_document'][$allfields_translated_to_solr['parent_sequence_id']]) && !$result_is_top_media) {
$sequence_number = (array) $extradata_from_item['search_api_solr_document'][$allfields_translated_to_solr['parent_sequence_id']];
if (isset($sequence_number[0]) && !empty($sequence_number[0]) && ($sequence_number[0] != 0)) {
// We do all this checks to avoid adding a strange offset e.g a collection instead of a CWS
Expand Down Expand Up @@ -322,6 +327,10 @@ protected function flavorfromSolrIndex(string $term, int $nodeid, string $proces
if (isset($page_number_by_id[$sol_doc_id])) {
// If we have a Solr doc (means children) and their own page number use them here.
$page_number = $page_number_by_id[$sol_doc_id];
// If the child is a pdf it might already have a relative offset?
// issue with this approach is that we don't know
// how many extra offsets are the previous children adding so this requires
// each child to be simply a single Image ...
}
else {
// If not the case (e.g a PDF) go for it.
Expand Down