[GeoNetwork-users] HOW TO index numeric fields

Hi GeoNetwork users,

I'm new on this software and I've recently installed the current release (v.2.10.3).

I'm trying to create a new metadata schema plugin for GeoNetwork on Earth Observation products (i.e. OGC 10-025r1 : Earth Observation Metadata profile of Observations & Measurements v.2.0) following the steps described within the Developer Manual.

The actual state of the art is that the new plugin "om-2_0_0" has been deployed correctly under the schema_plugins directory with all the mandatory information needed for metadata ingestion purposes (i.e. original schemas, and .xsl files) ... but I didn't work a lot on the presentation part.

I've mapped some textual fields inside the plugin index-fields.xsl but I've got an issue on making queryable a numeric field with lucene (i.e. Cloud Coverage Percentage, double) for doing range queries.
The steps I've made are described as follows:

- In the plugin index-fields.xsl file I've added the snippet code:
               <xsl:for-each select="om:result/opt:EarthObservationResult/opt:cloudCoverPercentage">
                                       <Field name="cloudCoverPercentage" string="{string(.)}" store="true" index="true"/>
                       </xsl:for-each>

- Under WEB-INF I've added the following snippet code in config-lucene.xml file:
  <numeric>

               ...

<Field name="cloudCoverPercentage" type="double"/>

</numeric>

- Under WEB-INF I've added the following snippet code in lucene.xml file following the implementation of "tempExtentBegin" reported inside this file:
                               <xsl:if test="(/request/cloudCoverPercentageMin or /request/cloudCoverPercentageMax)">

                                               <BooleanClause required="true" prohibited="false">

                                                              <BooleanQuery>

                                                                              <BooleanClause required="false" prohibited="false">

                                                                                              <RangeQuery fld="cloudCoverPercentage" inclusive="true">

                                                                                                             <xsl:if test="/request/cloudCoverPercentageMin">

                                                                                                                             <xsl:attribute name="lowerTxt">

                                                                                                                                             <xsl:value-of select="/request/cloudCoverPercentageMin"/>

                                                                                                                             </xsl:attribute>

                                                                                                             </xsl:if>

                                                                                                             <xsl:if test="/request/cloudCoverPercentageMax">

                                                                                                                             <xsl:attribute name="upperTxt">

                                                                                                                                             <xsl:value-of select="/request/cloudCoverPercentageMax"/>

                                                                                                                             </xsl:attribute>

                                                                                                             </xsl:if>

                                                                                              </RangeQuery>

                                                                              </BooleanClause>

                                                              </BooleanQuery>

                                               </BooleanClause>

                               </xsl:if>

Then in the administration section I've executed the "Rebuild/Optimize/Reload Lucene index" and then tried the following http queries:

- http://<host>:<port>/geonetwork/srv/eng/q?cloudCoverPercentageMin=30&cloudCoverPercentageMax=70<http://%3chost%3e:%3cport%3e/geonetwork/srv/eng/q?cloudCoverPercentageMin=30&cloudCoverPercentageMax=70>

- http://mazinga.planetek.it:9040/geonetwork/srv/eng/xml.search?cloudCoverPercentageMin=60&cloudCoverPercentageMax=70
But it results on "no records", when I'm sure that some are present under such filter.

What I'm doing wrong?
Can someone give me some hints?

Thanks in advance for your help.
Nick.

Hi, For range field you need to update UserQueryInput
https://github.com/geonetwork/core-geonetwork/blob/develop/core/src/main/java/org/fao/geonet/kernel/search/UserQueryInput.java#L237
in order to define from and to criteria (which will be used by the q search
service). The config you made in index-fields and config-lucene looks good.

HTH.

Francois

2014-07-23 17:15 GMT+02:00 Nicola Lunanova <lunanova@anonymised.com>:

Hi GeoNetwork users,

I'm new on this software and I've recently installed the current release
(v.2.10.3).

I'm trying to create a new metadata schema plugin for GeoNetwork on Earth
Observation products (i.e. OGC 10-025r1 : Earth Observation Metadata
profile of Observations & Measurements v.2.0) following the steps described
within the Developer Manual.

The actual state of the art is that the new plugin "om-2_0_0" has been
deployed correctly under the schema_plugins directory with all the
mandatory information needed for metadata ingestion purposes (i.e. original
schemas, and .xsl files) ... but I didn't work a lot on the presentation
part.

I've mapped some textual fields inside the plugin index-fields.xsl but
I've got an issue on making queryable a numeric field with lucene (i.e.
Cloud Coverage Percentage, double) for doing range queries.
The steps I've made are described as follows:

- In the plugin index-fields.xsl file I've added the snippet code:
               <xsl:for-each
select="om:result/opt:EarthObservationResult/opt:cloudCoverPercentage">
                                       <Field name="cloudCoverPercentage"
string="{string(.)}" store="true" index="true"/>
                       </xsl:for-each>

- Under WEB-INF I've added the following snippet code in
config-lucene.xml file:
  <numeric>

               ...

<Field name="cloudCoverPercentage" type="double"/>

</numeric>

- Under WEB-INF I've added the following snippet code in
lucene.xml file following the implementation of "tempExtentBegin" reported
inside this file:
                               <xsl:if
test="(/request/cloudCoverPercentageMin or
/request/cloudCoverPercentageMax)">

                                               <BooleanClause
required="true" prohibited="false">

<BooleanQuery>

    <BooleanClause required="false" prohibited="false">

                    <RangeQuery fld="cloudCoverPercentage" inclusive="true">

                                   <xsl:if
test="/request/cloudCoverPercentageMin">

                                                   <xsl:attribute
name="lowerTxt">

<xsl:value-of select="/request/cloudCoverPercentageMin"/>

                                                   </xsl:attribute>

                                   </xsl:if>

                                   <xsl:if
test="/request/cloudCoverPercentageMax">

                                                   <xsl:attribute
name="upperTxt">

<xsl:value-of select="/request/cloudCoverPercentageMax"/>

                                                   </xsl:attribute>

                                   </xsl:if>

                    </RangeQuery>

    </BooleanClause>

</BooleanQuery>

                                               </BooleanClause>

                               </xsl:if>

Then in the administration section I've executed the
"Rebuild/Optimize/Reload Lucene index" and then tried the following http
queries:

- http://
<host>:<port>/geonetwork/srv/eng/q?cloudCoverPercentageMin=30&cloudCoverPercentageMax=70<http://
%3chost%3e:%3cport%3e/geonetwork/srv/eng/q?cloudCoverPercentageMin=30&cloudCoverPercentageMax=70>

-
http://mazinga.planetek.it:9040/geonetwork/srv/eng/xml.search?cloudCoverPercentageMin=60&cloudCoverPercentageMax=70
But it results on "no records", when I'm sure that some are present under
such filter.

What I'm doing wrong?
Can someone give me some hints?

Thanks in advance for your help.
Nick.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork