Re: [EP-underground] Questions about subjects
ePrints Support <[email protected]> Fri, 15 Nov 2002 11:54:12 +0000
| Newsgroups | gmane.comp.web.eprints.general |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Nov 14, 2002 at 04:07:05 -0600, Alan Schmitz wrote:
> I've got a couple of questions regarding the use of subjects in the Eprints
> software. The first one is fairly simple. When a user does a keyword
> search, are the words used in the subject headings searched as well?
no. And searching subjects is done by subject key not name... BUT This could
be achieved by adding a metadata field which is not edited by the submitter
or editor but is created automatically. (c/f automatic fields in the config)
This field could just be set to the names of all subjects in this field. If
you want all post a code fragment.
Your second question is tricky. There's no really good way. The correct way
in theory is to create a subject node (all_counties) with a list of parents,
being all counties. But this will look really bad in the forms.
Another option would be to use the automatic fields function (kinda like a
trigger which runs each time the record is changed). If "ALL Counties" is
set (either a subject or a seperate boolean field) it then sets the subjects
on that item to be all the counties, and then change the abstract renderer to
not list them all if ALL is true.
AHhh. Better yet!! Create a second IDENTICAL subjects field called something
like searchsubjects. In the trigger we copy all the values from field subjects
into it then set subjects in this to all true if the user has selected the
general subject/field. This way if the user goes back to edit the subjects field
it won't be a horrid mess of selected counties! You then edit the simplesearch,
advance search and browse views to apply to field "searchsubjects".
This should be quite simple. OK. Assume we have 2 new fields, searchsubjects
and subjectstext.
{ name => "searchsubjects", type=>"subject", top=>"subjects", multiple => 1, browse_link => "subjects" },
{ name => "subjectstext", type => "longtext" },
we'd make the following trigger
sub set_eprint_automatic_fields
{
my( $eprint ) = @_;
my $searchsubjects = [];
my $setall = 0;
foreach my $subjid ( $eprint->get_value( "subjects" ) )
{
push @{$searchsubjects}, $subjid;
if( $subjid eq "all" ) # or whatever the key for the ALL field is
{
$setall = 1;
}
}
# set ALL the searchsubjects if the flag is set
if( $setall )
{
foreach my $subjid (
"dallas",
"foo",
"baz",
"fnord",
"bar" )
{
push @{$searchsubjects}, $subjid;
}
}
$eprint->set_value( "searchsubjects", $searchsubjects );
my $stext = "";
foreach my $subj ( @{$searchsubjects} )
{
$stext .= EPrints::Utils::tree_to_utf8(
$subj->render_description )." ";
}
$eprint->set_value( "subjectstext", $stext );
}
ok maybe that's more complicated than I thought. There is also the catch
that you will need to reindex everything if you add a new county.
You would then make your keyword search over
title/abstract/keywords/subjectstext
I hope all this makes some kinda sense.
> The second question is a little more complicated, because I'm trying to use
> Eprints to archive some specialized documents. These documents include
> various data tables from the US Census Bureau. Most of the documents
> include information for a unique region in the state. A few documents
> include a single statistic about every region in the state. I'm planning
> on setting up a hierarchy, similar to subject, called region.
>
> A short version of this hierarchy might look like:
>
> County
> County : Dallas
> County : Polk
> County : Story
>
> I have a document called "Median Household Income by County", which
> includes the median household income for all counties in the state. I want
> to make sure that someone doing a subject search will be able to find it,
> even if they're looking for the median household income for Polk County.
>
> What kind of subject hierarchy should I use, and how should I enter this
> document into Eprints? Should I select every county on the region list, or
> is there a better way?
>
> Thanks,
> Alan Schmitz
>
>
> -----
> SILO Coordinator
> State Library of Iowa
--
Christopher Gutteridge [email protected]
ePrints2 Coder, Support and Stuff +44 23 8059 4833