multi-term search queries in geonetwork 3.4

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

multi-term search queries in geonetwork 3.4

Jo Cook
Hi List,

I'm trying to understand how to create multi-term search queries in the
geonetwork search box in 3.4, for example term1 OR term2.

I've read up on the lucene query syntax but whatever I try produces 0
results.

Could someone give me an example of how to correctly use an OR query
please? I'd be happy to contribute to the user documentation with some
examples.

Thanks

Jo

--
*Jo Cook*
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For urgent
responses at that time, please visit support.astuntechnology.com or phone
our office on 01372 744009

--
--
Astun Technology Ltd, The Coach House, 17 West Street, Epsom, Surrey,
KT18 7RL, UK 
t:+44 1372 744 009 w: astuntechnology.com
<http://astuntechnology.com/> twitter:@astuntech
<https://twitter.com/astuntech>



iShare - enterprise geographic
intelligence platform <https://astuntechnology.com/ishare/>
GeoServer,
PostGIS and QGIS training <https://astuntechnology.com/services/#training>

Helpdesk and customer portal
<http://support.astuntechnology.com/support/login>




Company registration
no. 5410695. Registered in England and Wales. Registered office: 120 Manor
Green Road, Epsom, Surrey, KT19 8LN VAT no. 864201149.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork
Reply | Threaded
Open this post in threaded view
|

Re: multi-term search queries in geonetwork 3.4

Jose Garcia
Hi Jo

From the UI, it's used the search field *any *, that is mapped to a Lucene
field call *any* also, that for each metadata contains all the text content
of the metadata. It doesn't matter what you write in the UI search field it
produces a query with an AND of all terms, so if you search for sample
downloadin the UI or in the q service:
http://localhost:8080/geonetwork/srv/eng/q?_content_type=json&
*any=sample%20download*

that produces this Lucene query: *+(+any:sample +any:download)* that is and
AND for both terms.

Even if you write sample or download, the or term is currently removed as
the any field is setup as Lucene analysed field and it's processed to
tokenize the search values and remove stopword (useless search items like:
the, or, etc.)


There's another search field call *or* that is mapped to the same Lucene
field *any, *but if you use it (it requires to update the UI field or use
the q service:
http://localhost:8080/geonetwork/srv/eng/q?_content_type=json&
*or=sample%20download*

that produces this Lucene query: *+(any:sample any:download)* that is and
AND for both terms.


So currently in the search field that is used in the UI, sending the values
separated with or it doesn't affect, it depends on the search field
configured (*any* / *or*), by default is used *any*. This probably requires
some review to improve the way that works.


Other Lucene fields that are not configured to be analysed (not configured
here:
https://github.com/geonetwork/core-geonetwork/blob/3.4.x/web/src/main/webapp/WEB-INF/config-lucene.xml#L330-L341),
for example *topicCat*, you can send the field with the values separated by
the word *or* at least from the q service, from the UI it's not available,
but could be added:

http://localhost:8080/geonetwork/srv/eng/q?topicCat =farming+or+biota

that produces this Lucene query:  *+(topicCat:farming **topicCat:biota**) *with
an OR of the values


Another option is to use an or for a value between different fields, so for
example if the current search field instead of using *any* field, would use
*title_OR_abstract_OR_any* field name, the search would be done in the 3
fields, the good point about this is that can be configured the boost for
the fields to promote in the sort by relevance to give higher relevance to
metadata containing the search items in the title or abstract (A change
related to this will be committed soon to improve the search results).


Regards,
Jose García





On Fri, May 18, 2018 at 11:43 AM, Jo Cook <[hidden email]>
wrote:

> Hi List,
>
> I'm trying to understand how to create multi-term search queries in the
> geonetwork search box in 3.4, for example term1 OR term2.
>
> I've read up on the lucene query syntax but whatever I try produces 0
> results.
>
> Could someone give me an example of how to correctly use an OR query
> please? I'd be happy to contribute to the user documentation with some
> examples.
>
> Thanks
>
> Jo
>
> --
> *Jo Cook*
> t:+44 7930 524 155/twitter:@archaeogeek
> Please note that currently I do not work on Friday afternoons. For urgent
> responses at that time, please visit support.astuntechnology.com or phone
> our office on 01372 744009
>
> --
> --
> Astun Technology Ltd, The Coach House, 17 West Street, Epsom, Surrey,
> KT18 7RL, UK
> t:+44 1372 744 009 w: astuntechnology.com
> <http://astuntechnology.com/> twitter:@astuntech
> <https://twitter.com/astuntech>
>
>
>
> iShare - enterprise geographic
> intelligence platform <https://astuntechnology.com/ishare/>
> GeoServer,
> PostGIS and QGIS training <https://astuntechnology.com/services/#training>
>
> Helpdesk and customer portal
> <http://support.astuntechnology.com/support/login>
>
>
>
>
> Company registration
> no. 5410695. Registered in England and Wales. Registered office: 120 Manor
> Green Road, Epsom, Surrey, KT19 8LN VAT no. 864201149.
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> GeoNetwork-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geonetwork-users
> GeoNetwork OpenSource is maintained at http://sourceforge.net/
> projects/geonetwork
>



--













*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/>Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv>
<https://twitter.com/geocat_bv>
<https://plus.google.com/u/1/+GeocatNetbv/posts>Please consider the
environment before printing this email.*
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork
Reply | Threaded
Open this post in threaded view
|

Re: multi-term search queries in geonetwork 3.4

Jose Garcia
Small correction, this is wrong in previous mail:


There's another search field call *or* that is mapped to the same Lucene
field *any, *but if you use it (it requires to update the UI field or use
the q service: http://localhost:8080/geonetwork/srv/eng/q?_
content_type=json&*or=sample%20download*

that produces this Lucene query: *+(any:sample any:download)* that is and
AND for both terms.


should be:

There's another search field call *or* that is mapped to the same Lucene
field *any, *but if you use it (it requires to update the UI field or use
the q service: http://localhost:8080/geonetwork/srv/eng/q?_
content_type=json&*or=sample%20download*

that produces this Lucene query: *+(any:sample any:download)* that is and OR
for both terms.


Regards,
Jose García

On Fri, May 18, 2018 at 12:13 PM, Jose Garcia <[hidden email]>
wrote:

> Hi Jo
>
> From the UI, it's used the search field *any *, that is mapped to a
> Lucene field call *any* also, that for each metadata contains all the
> text content of the metadata. It doesn't matter what you write in the UI
> search field it produces a query with an AND of all terms, so if you search
> for sample downloadin the UI or in the q service: http://localhost:8080/
> geonetwork/srv/eng/q?_content_type=json&*any=sample%20download*
>
> that produces this Lucene query: *+(+any:sample +any:download)* that is
> and AND for both terms.
>
> Even if you write sample or download, the or term is currently removed as
> the any field is setup as Lucene analysed field and it's processed to
> tokenize the search values and remove stopword (useless search items like:
> the, or, etc.)
>
>
> There's another search field call *or* that is mapped to the same Lucene
> field *any, *but if you use it (it requires to update the UI field or use
> the q service: http://localhost:8080/geonetwork/srv/eng/q?_
> content_type=json&*or=sample%20download*
>
> that produces this Lucene query: *+(any:sample any:download)* that is and
> AND for both terms.
>
>
> So currently in the search field that is used in the UI, sending the
> values separated with or it doesn't affect, it depends on the search field
> configured (*any* / *or*), by default is used *any*. This probably
> requires some review to improve the way that works.
>
>
> Other Lucene fields that are not configured to be analysed (not configured
> here: https://github.com/geonetwork/core-geonetwork/
> blob/3.4.x/web/src/main/webapp/WEB-INF/config-lucene.xml#L330-L341), for
> example *topicCat*, you can send the field with the values separated by
> the word *or* at least from the q service, from the UI it's not
> available, but could be added:
>
> http://localhost:8080/geonetwork/srv/eng/q?topicCat =farming+or+biota
>
> that produces this Lucene query:  *+(topicCat:farming **topicCat:biota*
> *) *with an OR of the values
>
>
> Another option is to use an or for a value between different fields, so
> for example if the current search field instead of using *any* field,
> would use *title_OR_abstract_OR_any* field name, the search would be done
> in the 3 fields, the good point about this is that can be configured the
> boost for the fields to promote in the sort by relevance to give higher
> relevance to metadata containing the search items in the title or abstract
> (A change related to this will be committed soon to improve the search
> results).
>
>
> Regards,
> Jose García
>
>
>
>
>
> On Fri, May 18, 2018 at 11:43 AM, Jo Cook <[hidden email]>
> wrote:
>
>> Hi List,
>>
>> I'm trying to understand how to create multi-term search queries in the
>> geonetwork search box in 3.4, for example term1 OR term2.
>>
>> I've read up on the lucene query syntax but whatever I try produces 0
>> results.
>>
>> Could someone give me an example of how to correctly use an OR query
>> please? I'd be happy to contribute to the user documentation with some
>> examples.
>>
>> Thanks
>>
>> Jo
>>
>> --
>> *Jo Cook*
>> t:+44 7930 524 155/twitter:@archaeogeek
>> Please note that currently I do not work on Friday afternoons. For urgent
>> responses at that time, please visit support.astuntechnology.com or phone
>> our office on 01372 744009
>>
>> --
>> --
>> Astun Technology Ltd, The Coach House, 17 West Street, Epsom, Surrey,
>> KT18 7RL, UK
>> t:+44 1372 744 009 w: astuntechnology.com
>> <http://astuntechnology.com/> twitter:@astuntech
>> <https://twitter.com/astuntech>
>>
>>
>>
>> iShare - enterprise geographic
>> intelligence platform <https://astuntechnology.com/ishare/>
>> GeoServer,
>> PostGIS and QGIS training <https://astuntechnology.com/services/#training
>> >
>>
>> Helpdesk and customer portal
>> <http://support.astuntechnology.com/support/login>
>>
>>
>>
>>
>> Company registration
>> no. 5410695. Registered in England and Wales. Registered office: 120
>> Manor
>> Green Road, Epsom, Surrey, KT19 8LN VAT no. 864201149.
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> GeoNetwork-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/geonetwork-users
>> GeoNetwork OpenSource is maintained at http://sourceforge.net/project
>> s/geonetwork
>>
>
>
>
> --
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Vriendelijke groeten / Kind regards,Jose García
> <http://www.geocat.net/>Veenderweg 136721 WD BennekomThe NetherlandsT: +31
> (0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv>
> <https://twitter.com/geocat_bv>
> <https://plus.google.com/u/1/+GeocatNetbv/posts>Please consider the
> environment before printing this email.*
>



--













*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/>Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv>
<https://twitter.com/geocat_bv>
<https://plus.google.com/u/1/+GeocatNetbv/posts>Please consider the
environment before printing this email.*
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoNetwork-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork