nsandlin / linepig

ID resource for erigonine spiders, using KE Emu & IMu.
http://linepig.fieldmuseum.org/
4 stars 0 forks source link

Exclude urls from Multimedia count #56

Open nsandlin opened 3 years ago

nsandlin commented 3 years ago

Now that all non-url Mulitmedia records have a DetResourceType "Stillimage" value, can we use that to correct the count (which currently includes the urls)? This variable is $resultsCount in search-results.blade.php, which comes from a count (by Keywords, Genus, or Species) in SearchController.php.

  1. Include the field in emuconfig.search_fields, eg as imgtype

  2. Add it to DB::insert in SearchImport.php

  3. In SearchController.php, modify public function getDBQuery($genus, $species, $keywords) to include an if image == Stillimage, something like

From: $query->where('genus', '=', trim($genus)); To: $query->where('imgtype', '=' && 'genus', '=', trim($genus));

peteherbst commented 3 years ago

Would it simplify things to exclude non-Image multimedia records entirely?

e.g. For the Search Import, if the record resource type is NOT "Image", then do not add it to the search.

nsandlin commented 3 years ago

Well, that would be simpler than three separate ifs (and possibly more later). Apparently we don't need them, because it looks like Multimedia.php is getting the info from the main MM record (below). For type, are you looking at the DetResourceType field? That is all either Stillimage or URL now.

public function getCollectionRecordURL($record): string
{
    $firstfour = "";
    // If the attached Multimedia record is an external link, return that URL.
    if (!empty($record['RelRelatedMediaRef_tab'][0])) {
        $firstfour = substr($record['RelRelatedMediaRef_tab'][0]['MulIdentifier'], 0, 4);
        if ($firstfour == "http") {
            return $record['RelRelatedMediaRef_tab'][0]['MulIdentifier'];
        }
    } [...]
peteherbst commented 3 years ago

What if the criteria for the SearchImport was as simple as:

if != URL

Would that work for us?

nsandlin commented 1 year ago

Looks like that did work, and we just neglected to close the ticket.

nsandlin commented 2 weeks ago

Question: Should we maybe go back to if == Stillimage rather than if != url, since now I need to upload images to include in the new project narrative pages. The crops and dimensions are different from the ones in the gallery (reworked to have a clean, consistent look on the page with text), and we don't want them to show up in the gallery. Then I could make the DetResourceType just "Image" instead of Stillimage so the import would skip them. Or do you have a better idea?

peteherbst commented 1 week ago

Should I be making this change on the new dev site or on the "old", current site?

nsandlin commented 1 week ago

Just the new! I just highjacked this old issue to reuse the background.

peteherbst commented 1 week ago

Ok, no problem! So, quick question, which field stores the Stillimage info?

For this: if == Stillimage

nsandlin commented 1 week ago

DetResourceType

On Tue, Sep 10, 2024 at 3:52 PM Pete Herbst @.***> wrote:

Ok, no problem! So, quick question, which field stores the Stillimage info?

For this: if == Stillimage

— Reply to this email directly, view it on GitHub https://github.com/nsandlin/linepig/issues/56#issuecomment-2341988828, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABISACOVVFVMWJ7ISDEBWGTZV5LXFAVCNFSM6AAAAABNSWHSQWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBRHE4DQOBSHA . You are receiving this because you modified the open/close state.Message ID: @.***>