EPrints Technical Mailing List Archive

Message: #02531


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Search, for partial matches


Perhaps your email field is of type "email" or "id" in which case an exact match is performed?

Try setting the "match" parameter to "IN" in your search (match is the 3rd argument of ->add_field)

Also how stuff is searched/indexed is defined in the metafield classes (e.g. look at MetaField/Email::get_index_codes) - look what's in your foo__rindex table to see what has been indexed.

Seb.


On 21/01/14 15:21, Ian Stuart wrote:
I want to perform a search... however I want to search for
a) all records where *part* of the field matches, and
b) I do not want that search to be case-sensitive

    my $email = 'Ian';
    my $ds = $session->get_repository->get_dataset('foo');
    my $searchexp = EPrints::Search->new(
        session => $session,
        dataset => $ds,
    );
    $searchexp->add_field( $ds->get_field('email'), $email );
    warn $searchexp->render_description->toString;
    my $results = $searchexp->perform_search;
    warn "found " . $results->count . " records\n";

returns 0 matches, even though there is at least one user (me) with an
email address of "ian.stuart@ed...." in the dataset foo

Any suggestions?
(as the dataset isn't part of the normal EPrints system, indexing
worries me [and I don't know who to set it up either, but that's another
story])