EPrints Technical Mailing List Archive

Message: #04225


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

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


Great!

this is undocumented, I've search a lot for a way to insert EX as option, and didn't find anything about match.

 Anyway, what they really asked me is a wildcard search, I mean:

 doc1: field contains ABCYZ
 doc2: field contains ABCABC
 doc1: field contains ABDEF

they want to search for

 ABC

 and get doc1 and doc2.

Can this be possible with Eprints? May I use match=IN? The problem is that a string as F.14.13 is not indexed at all because F is a single letter word...

 P.S: is sql_index => 1 mandatory or just help for performances?

Il 13/05/2015 08:11, Gilles Fournié ha scritto:
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@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/

*** 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/