See the Mailing Lists Page for how to subscribe and unsubscribe.
eprints_tech messages
Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.
[EP-tech] Re: Search API
From: Stephen Shorrock <sms67 AT cam.ac.uk>
Date: Wed, 05 Nov 2008 16:27:51 +0000
| Threading: | ↑ [EP-tech] Search API from admin AT company.org.ua • This Message |
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** EPrints community wiki - http://wiki.eprints.org/ admin AT company.org.ua wrote: > http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech > *** EPrints community wiki - http://wiki.eprints.org/ > Hello > I have problem (with example from api_core.pdf ) Not Work > > my $session = new EPrints::Session; > exit( 0 ) unless( defined $session ); > my $ds = $session->get_repository->get_dataset( ↵ "archive" ); > # Create search expression > my $search = new EPrints::Search( ↵ > session => $session, ↵ > dataset => $ds, ↵ > custom_order => 'title' ); ↵ > $search->add_field( > [ > $ds->get_field("type"), > $ds->get_field("title") > ], > "book_section", > "IN", > "ALL" ); > my $list = $search->perform_search; > # Modify result for return > my AT result=(); ↵ > # Map function to each result ↵ > $list->map( ↵ > sub { ↵ > my( $session, $dataset, $eprint ) = AT _; ↵ > push AT result, $eprint->get_id; ↵ > } ↵ > ); > > If delete "$ds->get_field("title")" this exemple ↵ is work > How to search in full text search which matches > word in title or abstract ? > > > Hello admin, The way I read the perldocs is that if you were searching for book sections with the string 'example' in the title or abstract you would add the following search fields: $search->add_field( $ds->get_field("type"), "book_section", "EQ", "ALL" ); (finds all book_sections) and $search->add_field( ↵ [$ds->get_field("abstract"),$ds->get_field("title")], "example", "IN", "ANY" ); Regards, Stephen perldoc: 3. The "match" parameter which can be one of: match=IN Treat the value as a list of whitespace-separated words. Search for each one in the full-text index. In the case of subjects, match these subject ids or the those of any of their decendants in the subject tree. match=EQ (equal) Treat the value as a single string. Match only fields which have this value. match=EX (exact) If the value is an empty string then search for fields which are empty, as oppose to skipping this search field. In the case of subjects, match the specified subjects, but not their decendants. match=NO This is only really used internally, it means the search field will just fail to match anything without doing any actual search\u2010 ing. 4. the "merge" parameter which can be one of: merge=ANY Match an item if any of the words in the value match. merge=ALL Match an item only if all of the words in the value match.
[index] [prev] [next] [options] [help]




