customizing advanced search

323 views
Skip to first unread message

wsalesky

unread,
Jan 11, 2010, 7:39:34 PM1/11/10
to Omeka Dev
I'm looking for some help customizing the advanced search options, I
would like to limit the fields in the advanced search to a selected
subset. Any help would be appreciated!

Thanks,
Winona

Will Riley

unread,
Jan 11, 2010, 11:50:13 PM1/11/10
to Omeka Dev
Hey Winona,

Thanks for the excellent question.

Here's what I would try:

1. Copy application/views/scripts/items/advanced-search.php to your
theme under the items folder.

So you should have something like:
themes/yourtheme/items/advanced-search

2. Add the some code like the following to the top of your theme:

<?php echo js('jquery'); ?>
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(document).ready(function() {
var blackListElements = new Array();
blackListElements[0] = "Title";
blackListElements[1] = "Description";
blackListElements[2] = "Creator";
for (var i = 0; i < blackListElements.length; i++){
jQuery("#advanced-0-element_id option[label='" +
blackListElements[i] + "']").hide();
}
});
</script>

3. The sample code above should hide the "Title", "Description", and
"Creator" elements from showing up on your advanced search page. You
can change the blacklist of elements to whatever ones you want to
remove.

Note: This only hides the elements from the advanced-search page. It
is not meant as a way to securely hide those fields in Omeka.
Currently, all the elements in Omeka are searchable via simple search,
all of the elements may show up in other output formats. We do not
have private/public element fields.

Let me know if this works.

wsalesky

unread,
Jan 13, 2010, 10:26:32 AM1/13/10
to Omeka Dev
Thanks Will,
That did the trick.
-Winona

wsalesky

unread,
Jan 21, 2010, 8:49:33 PM1/21/10
to Omeka Dev
I have another question about customizing this search. i would like to
be able to add limits in the form of checkboxes, one to only retreive
items if they include a dublin core type of digital audio file and one
to return only if the transcript field is not empty. Not sure how to
do this.

thanks!
-Winona

On Jan 11, 11:50 pm, Will Riley <wanderingw...@gmail.com> wrote:

Barb Ack

unread,
Sep 23, 2012, 7:49:43 PM9/23/12
to omek...@googlegroups.com
I've just tried this with my version 1.5 Omeka install.

If I only list three blacklist items they are removed from the advanced search display.  If I list all the fields I want to hide,  then it is as if I have no override at all  -- all of the DC fields still show in the dropdown.

Could there be a way to blacklist all and then allow only the 8 I want to be available to my users?

Thanks, Barb
Reply all
Reply to author
Forward
0 new messages