[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: exact match on advanced search



Hi,

I have already seen an advice about using "id" and I had a a small 
concern about it.

The Wiki says 
(http://wiki.eprints.org/w/Category:EPrints_Metadata_Fields#Internal-use_and_Deprecated_Field_Types) 
:

      Internal-use and Deprecated Field Types

         Basic metadata field
             File - virtual field represtenting the files in a document
    *  Id - deprecated (do not use)*
             Int
                 Year - deprecated (do not use)

So is the Wiki right or not ? Is 'ID" really safe to use ?

We had to find a way to search on multiword keywords and so we also 
needed exact matches.
As ID is advertised as "do not use", we had to find another way.
We ended up adding a "match" attribute to the field definition,...

    {
             name => 'agrovoc_mat',
             type => 'compound',
             multiple => 1,
             input_boxes => 3,
             fields => [
                     {
                             sub_name => 'motcle',
                             type => 'text',
                             sql_index => 1,
    *match => 'EX',*
                             browse_link => 'agrovoc_mat',
                     },
                     {
                             sub_name => 'id',
                             type => 'bigint',
                     },
             ],
    },

BTW, I'm not sure at all whether this solution is safer or not...

If someone can clarify that, it would be nice.

Thanks.
GF



Le 12/05/2015 17:53, Timothy Miles-Board a ?crit :
>
> What type of field is it? Text? Try changing to id - this doesn't do 
> any preprocessing of search terms.
>
> Tim
>
> On 12 May 2015 3:11 pm, Yuri <yurj at alfa.it> wrote:
>
>     Hi!
>
>       I would like to change a text search on a field to be an exact
>     match.
>
>     now I've:
>
>         search_fields => [
>            { meta_fields => [ $EPrints::Utils::FULLTEXT ] },
>            { meta_fields => [ "localizzazione" ] },
>            { meta_fields => [ "tipo_fruizione" ] },
>            { meta_fields => [ "collocazione" ] },
>
>     [..]
>
>     I would like to have the "localizzazione" field to be an exact match
>     instead of a text search (which instead removes dots, spaces and
>     so on).
>
>     Which is the best way to do it? I need it in the advanced search
>     form,
>     it is not a custom script (which can use filters and works).
>     *** Options:
>     http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
>     *** Archive: http://www.eprints.org/tech.php/
>     *** EPrints community wiki: http://wiki.eprints.org/
>     *** EPrints developers Forum: http://forum.eprints.org/
>
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/