Hide useless fields in advanced search

I would like to hide all fields which are not used in the advanced search form.

In omeka classic, it is possible to edit application/views/scripts/items/search-form.php but I cannot find anything similar for Omeka S.

I tested the module “Custom Advanced Search” but it adds only the possibility to insert a text before the form.

There is a pull request on github for that: https://github.com/omeka/omeka-s/pull/1185

You want to take out entire fields (like the Class selector), or make changes to the ones that are there, or both?

Removing them completely is already possible with the current event there, just not currently implemented in Custom Advanced Search.

Hi Jflatness and Daniel_KM,

I just want to have only the fields that are actually used (that is to say the ones with at least one item which used them).

So I guess it is “take out entire fields” choice. An automatic way to do this would be great. If you are concern with the api query and the performance impact (cf. github pull request linked in Daniel post), at least an manual option to select fields we want (like reference module) would be a start.

With omeka S and the ability to import ontologies, there are so many fields it is impossible to use efficiently advanced search. For example, I added the schema.org ontology just for using several fields, all of them are available in advanced search which make no sense.

Bump!

How to go about customizing Advanced Search on a per Site basis? We have project here that wants to lean heavily on Advanced Search (not Pages/Exhibition) and needs some changes.

Mark

Actually, it’s occurring to me that I can do what needs to be done by just embedding a custom HTML form into a page that posts to the Advanced Search endpoint with hidden field values:

<div class="advanced-search-content">

<form id="symonds-search" method="get" action="/omeka-s/s/symonds-library/item">

<input aria-label="Query text" class="query-text" name="property[0][text]" type="text" value="" />
<input class="joiner" name="property[0][joiner]" type="hidden" value="and" />
<input aria-label="Property" class="query-property" name="property[0][property]" type="hidden" value="" />
<input aria-label="Query type" class="query-type" name="property[0][type]" type="hidden" value="in" />
<input aria-labelledby="by-item-set-label" name="item_set_id[]" type="hidden" value="310" />
<input aria-labelledby="by-item-set-label" name="item_set_id[]" type="hidden" value="1004" />
<input name="resource_template_id[]" type="hidden" value="3" />

<input name="submit" type="submit" value="Search" />

</form>

</div>

And yet, whenever I save this form, the WYSIWYG editor strips out my FORM tags. No fair!

Mark

Hi,

If you use Omeka-S v1.3.0+, have you tried enabling the Search option named “Restrict to templates” in your site settings?
It does not restrict search fields to thoses only used, but you can set a selection based on resource templates.
Ultimately, you can create a resource template that contains only the fields you want and use it for this purpose.

@ManOnDaMoon I don’t have this option on my Omeka 1.4.0 installation.

Are you sure? It is located in a site specific settings, be careful not to look in Omeka S global settings:

You’ll find a ‘Search’ section where you’ll have to select the resource template with the fields you want to filter, and then tick the option below:
image

Ok, this is happening because I use the Search module which replaces this part of the site settings.
I reported the bug:

Thanks!

We have a Resource Template consisting of 16 Dublin Core fields.

In our Site Settings --> Search I have selected it and clicked on Restrict to templates.

Am I to expect, now, that when I go to Advanced Search for this site I will see a form with textboxes for our 16 Dublin Core fields and the ability to Sort on any one of them? I do not.

A quick question: How can we, in Advanced Search, Sort by DC: Creator?

Confused,

Mark

Hello

When you go to advanced search on your site, you will see that the « Search by value » list is now only built using your 16 DC fields.
I’m not sure but I think there is a way to modify the Advanced Search URL in order to setup per-existing fields in the advanced search form, like I’m doing it’s this link: https://omekas.manondamoon.com/s/demo/item/search?property[0][joiner]=and&property[0][property]=225&property[0][type]=in&property[0][text]=Test&property[1][joiner]=or&property[1][property]=4&property[1][type]=in&property[1][text]=Test2&resource_class_id[]=121&item_set_id[]=7&resource_template_id[]=7

Thanks again. And I see what you’re saying. That Restrict to Templates thing is working for me.

BUT is there any way to (hopefully by default) Sort by Creator? The sort dropdown only contains Created, Title, Identifier, and Class. Not very useful. Basically, I think if we could simply set the default sort to Creator, Ascending, this would do what we want it to do. Forcing a sort of dc:creator asc on the URL string brings no joy!

Mark

Actually, I think the Search module may do what I want:

But for the life of me I can’t parse this instruction:

Add a page named Internal search or whatever you want, a path to access it, for example search or find , the index that was created in the previous step ( Internal here), and a form adapter ( Basic ) that will do the mapping between the form and the index. Forms added by modules can manage an advanced input field and/or filters.

Does anyone know of more fleshed out instructions for this module? It sure does seem like the intent of it is to facilitate the creation of custom search forms on a per site basis (although it doesn’t actually say that).

Mark

Dear all,

I have been reading with attention your comments. I work on Omeka-s 1.4.0.

My wish is to limit fields in the public advanced search menu i.e to delete from the menu some properties event if they do exist on the administrative side.

I also wish to delete the field “search by class” which is useless in my case.

And last request, I wish to limit the public query to some item-sets.

I used the site settings in order to limit items sets search as described above.
I also ckick on the button restrict templates.

However when I go public view, I still have access to all items-sets on the fields " Search by items-sets".

I also red the link thttps://github.com/omeka/omeka-s/pull/1185 in order to adapt php.files.
However as my files doest not strictly correspond to those on Github and specially the variable " $isOptionUsed", doest not exist in the files, I have not been able to change the advanced search as we wanted to.

My last error message was : ( Zend\View\Exception\RuntimeException Zend\View\Renderer\PhpRenderer::render: Unable … ).

I thank you in advance if you can tell how I can proceed.
Sincerely Yours,
Emilie

Hi all, the developers don’t have an easy to use solution yet, although defining a “resource template” and restricting a site to searching that is a good start.

Ultimately, what you want to do for now is customize the advanced search form via direct HTML. I am working on this for my site right now (edisondigital.rutgers.edu) and would love to contribute more details in the future, but for now, you should understand that the “theme” is where you can make these edits.

In particular, you can copy this file:
/application/view/common/advanced-search.phtml
from the base directory of your Omeka installation, and copy it into a theme:
for example:
/themes/centerrow/view/common

By doing so, you create a “child” or “duplicate” of the default display, which you can safely manipulate. When you break things or mess things up, you can simply delete the file to return back to the default view which is stored outside of the /theme directory.

The details of how to manipulate it, I will try to post later. But you could simply take the source (View Page Source or Inspect mode) from the advanced search page, edit it in a text editor, and then paste into a blank “advanced-search.phtml” located in /themes/theme_name/view/common.

I hope this helps someone.

I published a small patch on github for omeka (https://github.com/omeka/omeka-s/pull/1423) to get only the used terms. It’s available in module Next too. When installed, you just have to add the option "used_terms" => true,to the select (in the theme) or used=1 in an api query. An parameter is added in the site settings too to be applied by default in the advanced search page.

1 Like

This configuration (using Templates for restrict properties in advanced search) avoid functionality “List values in advanced search” from “Reference” module. Seems that file omeka-s\application\src\Form\Element\PropertySelect.php contains a function named getValueOptions() what build value without “data-term” and “data-property-id” attributes , used by jQuery plugin code in “Reference” module for this functionality.

I solved with this workarround on Omeka S 1.4.0 core file application/src/Form/Element/PropertySelect.php (see attached picture).