• Resolved jochundesign

    (@jochundesign)


    I’m using MLA to power a simple search for PDF files. We’ve recently changed the naming convention of our files and it’s thrown up a weird problem – if you use a search term of more than 6 characters, the search returns no results. E.g. if I search for 18E1025 nothing comes up but if I search for 18E102 (last digit removed) it returns all files with that string in their file name. How can I fix this?

    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your report and for the link to your Batch Inspection Certificates page. You did not include the text of the [mla_gallery] shortcode so I can’t try to reproduce your application exactly.

    However, I did some testing and discovered that in the current MLA version (2.73) the mla_search_fields=file (search on file name) feature is broken. Thank you for alerting me to this MLA defect!

    I have uploaded a new MLA Development Version dated 20180601 that contains a fix, and adds support for searching on ALT Text (that may not apply to your application). To get the Development Version you can follow the instructions in this earlier topic:

    PHP Warning on media upload with Polylang

    It would be great if you can install the Development Version and let me know how it works for you. Even if you’re not using the mla_search_fields=file feature the Development Version contains new debug logging messages that would help me investigate further.

    Thread Starter jochundesign

    (@jochundesign)

    Hi, thanks for the quick response. I installed the development version but it didn’t fix my problem, unfortunately.

    Here is the code I’m using:

    <form id=”mla-search-form” action=”.” method=”post”>
    <input id=”mla-search-box” name=”search-string” type=”text” value=”” />
    <input id=”submit” name=”submit” type=”submit” value=”GO” />
    </form>

    [mla_gallery post_mime_type=”application/pdf” post_parent=all s=”{+template:({+request:search-string+}|a-bad-term)+}” mla_nolink_text=”Enter a valid batch number.” posts_per_page=50 link=file size=icon mla_caption=’{+title+}‘ mla_target=”_blank”]

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and for taking the time to install and test the Development Version. Thanks as well for posting the full text of your form and shortcode.

    By default the keyword search triggered by the s= parameter will match values in the items’ Title and Description/Content fields. It will not match anything in the file name or other fields. You wrote “E.g.if I search for 18E1025 nothing comes up but if I search for 18E102 (last digit removed) it returns all files with that string in their file name.

    If you want to match values in the file name you must add a parameter to your shortcode, e.g., mla_search_fields=file or mla_search_fields="title,content,file". Give that a try and let me know if it helps.

    Thread Starter jochundesign

    (@jochundesign)

    Pardon my ignorance but whereabouts in my shortcode should I paste the new parameter? I tried a few places but it made no difference.

    Thank you for your efforts 🙂

    Plugin Author David Lingren

    (@dglingren)

    Thanks for trying my suggestion. The new parameter can go anywhere, e.g.,

    [mla_gallery post_mime_type=”application/pdf” post_parent=all s=”{+template:({+request:search-string+}|a-bad-term)+}” mla_search_fields="title,content,file" mla_nolink_text=”Enter a valid batch number.” posts_per_page=50 link=file size=icon mla_caption=’{+title+}‘ mla_target=”_blank”]
    

    or

    [mla_gallery]
    post_mime_type=”application/pdf”
    post_parent=all
    s=”{+template:({+request:search-string+}|a-bad-term)+}”
    mla_search_fields="title,content,file"
    mla_nolink_text=”Enter a valid batch number.”
    posts_per_page=50
    link=file
    size=icon
    mla_caption=’{+title+}‘
    mla_target=”_blank”
    [/mla_gallery]
    

    The second example uses the alternate “enclosing shortcode” format to make the shortcode easier to read.

    If this isn’t working for you it would be helpful to see the debug information for your shortcode’s processing. You can add mla_debug=true to display the debug information on the web page (it’s ugly and long, so don’t do it in production). You can add mla_debug=log to write the information to the error log, then go to the Settings/Media Library Assistant Debug tab to access the messages. If you need more specific instructions, let me know. Thanks for your patience and persistence in working with me on this issue.

    Plugin Author David Lingren

    (@dglingren)

    It has been a month since my last post in this topic. I hope you have found a solution to the problem you were experiencing.

    I am marking this topic resolved, but please update it if you have any remaining problems or further questions regarding filtering [mla_gallery] results by keyword/file name search terms.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Character limit on search terms?’ is closed to new replies.