You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Christian Köhler - ZFMK <c....@zfmk.de> on 2013/09/10 14:43:37 UTC

Facet values for spacial field

Hi,

I use the new SpatialRecursivePrefixTreeFieldType field to store geo
coordinates (e.g. 14.021666,51.5433353 ). I can retrieve the coordinates
just find so I am sure they are indexed correctly.

However when I try to create facets from this field, solr returns
something which looks like a hash of the coordinates:

Schema:

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
   <types>
    ...
     <fieldType name="location"
            class="solr.SpatialRecursivePrefixTreeFieldType"
            units="degrees" />
     ...
   <field name="geo_locality" type="location" indexed="true"
          stored="true"  />
</schema>

Result:
http://localhost/solr/browse?facet=true&facet.field=geo_locality ->
...
<lst name="facet_fields">
  <lst name="geo_locality">
   <int name="7zzzzzzzzzz">660</int>
   <int name="t4m70cmvej9">290</int>
   <int name="t4187pnmky3">214</int>
   <int name="t441z6vwv3j">179</int>
   <int name="t4328x4s6dj">165</int>
   <int name="t1c639yyxdr">143</int>
    ...
  </lst>
</lst>

Filtering by this hashes fails:
http://localhost/solr/browse?&q=&fq=geo_locality:"t4m70cmvej9"
java.lang.IllegalArgumentException: missing parens: t4m70cmvej9

How do I get the results of a single location using faceting?
Any thoughts?

Regards
Chris

--
Christian Köhler

Zoologisches Forschungsmuseum Alexander Koenig
Leibniz-Institut für Biodiversität der Tiere
Adenauerallee 160, 53113 Bonn, Germany
www.zfmk.de

Stiftung des öffentlichen Rechts
Direktor: Prof. J. Wolfgang Wägele
Sitz: Bonn
--
Zoologisches Forschungsmuseum Alexander Koenig
- Leibniz-Institut für Biodiversität der Tiere -
Adenauerallee 160, 53113 Bonn, Germany
www.zfmk.de

Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
Sitz: Bonn

Re: Facet values for spacial field

Posted by Erick Erickson <er...@gmail.com>.
It seems like the right thing to do here is store something
more intelligible than an encoded lat/lon pair and facet on
that instead. lat/lon, even bare are not all that useful
without some effort anywa...

FWIW,
Erick


On Wed, Sep 11, 2013 at 9:24 AM, Köhler Christian <C....@zfmk.de> wrote:

> Hi Eric (and others),
>
> thanx for the the explanation. This helps.
>
> For the usecase: I am cataloging findings of field expeditions. The
> collectors usualy store a single location for the field trip, so the numer
> of locations is limited.
>
> Regards
> Chris
> ________________________________________
> Von: Erick Erickson [erickerickson@gmail.com]
> Gesendet: Dienstag, 10. September 2013 19:14
> Bis: solr-user@lucene.apache.org
> Betreff: Re: Facet values for spacial field
>
> You might be able to facet by query, but faceting by
> location fields doesn't make a huge amount of sense,
> you'll have lots of facets on individual lat/lon points.
>
> What is the use-case you are trying to support here?
>
> Best,
> Erick
>
>
> On Tue, Sep 10, 2013 at 8:43 AM, Christian Köhler - ZFMK
> <c....@zfmk.de>wrote:
>
> > Hi,
> >
> > I use the new SpatialRecursivePrefixTreeFiel**dType field to store geo
> > coordinates (e.g. 14.021666,51.5433353 ). I can retrieve the coordinates
> > just find so I am sure they are indexed correctly.
> >
> > However when I try to create facets from this field, solr returns
> > something which looks like a hash of the coordinates:
> >
> > Schema:
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <schema name="example" version="1.5">
> >   <types>
> >    ...
> >     <fieldType name="location"
> >            class="solr.**SpatialRecursivePrefixTreeFiel**dType"
> >            units="degrees" />
> >     ...
> >   <field name="geo_locality" type="location" indexed="true"
> >          stored="true"  />
> > </schema>
> >
> > Result:
> > http://localhost/solr/browse?**facet=true&facet.field=geo_**locality<
> http://localhost/solr/browse?facet=true&facet.field=geo_locality>->
> > ...
> > <lst name="facet_fields">
> >  <lst name="geo_locality">
> >   <int name="7zzzzzzzzzz">660</int>
> >   <int name="t4m70cmvej9">290</int>
> >   <int name="t4187pnmky3">214</int>
> >   <int name="t441z6vwv3j">179</int>
> >   <int name="t4328x4s6dj">165</int>
> >   <int name="t1c639yyxdr">143</int>
> >    ...
> >  </lst>
> > </lst>
> >
> > Filtering by this hashes fails:
> > http://localhost/solr/browse?&**q=&fq=geo_locality<
> http://localhost/solr/browse?&q=&fq=geo_locality>
> > :"**t4m70cmvej9"
> > java.lang.**IllegalArgumentException: missing parens: t4m70cmvej9
> >
> > How do I get the results of a single location using faceting?
> > Any thoughts?
> >
> > Regards
> > Chris
> >
> > --
> > Christian Köhler
> >
> > Zoologisches Forschungsmuseum Alexander Koenig
> > Leibniz-Institut für Biodiversität der Tiere
> > Adenauerallee 160, 53113 Bonn, Germany
> > www.zfmk.de
> >
> > Stiftung des öffentlichen Rechts
> > Direktor: Prof. J. Wolfgang Wägele
> > Sitz: Bonn
> > --
> > Zoologisches Forschungsmuseum Alexander Koenig
> > - Leibniz-Institut für Biodiversität der Tiere -
> > Adenauerallee 160, 53113 Bonn, Germany
> > www.zfmk.de
> >
> > Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
> > Sitz: Bonn
> >
> --
> Zoologisches Forschungsmuseum Alexander Koenig
> - Leibniz-Institut für Biodiversität der Tiere -
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
>
> Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
>

AW: Facet values for spacial field

Posted by Köhler Christian <C....@zfmk.de>.
Hi Eric (and others),

thanx for the the explanation. This helps.

For the usecase: I am cataloging findings of field expeditions. The collectors usualy store a single location for the field trip, so the numer of locations is limited.

Regards
Chris
________________________________________
Von: Erick Erickson [erickerickson@gmail.com]
Gesendet: Dienstag, 10. September 2013 19:14
Bis: solr-user@lucene.apache.org
Betreff: Re: Facet values for spacial field

You might be able to facet by query, but faceting by
location fields doesn't make a huge amount of sense,
you'll have lots of facets on individual lat/lon points.

What is the use-case you are trying to support here?

Best,
Erick


On Tue, Sep 10, 2013 at 8:43 AM, Christian Köhler - ZFMK
<c....@zfmk.de>wrote:

> Hi,
>
> I use the new SpatialRecursivePrefixTreeFiel**dType field to store geo
> coordinates (e.g. 14.021666,51.5433353 ). I can retrieve the coordinates
> just find so I am sure they are indexed correctly.
>
> However when I try to create facets from this field, solr returns
> something which looks like a hash of the coordinates:
>
> Schema:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="example" version="1.5">
>   <types>
>    ...
>     <fieldType name="location"
>            class="solr.**SpatialRecursivePrefixTreeFiel**dType"
>            units="degrees" />
>     ...
>   <field name="geo_locality" type="location" indexed="true"
>          stored="true"  />
> </schema>
>
> Result:
> http://localhost/solr/browse?**facet=true&facet.field=geo_**locality<http://localhost/solr/browse?facet=true&facet.field=geo_locality>->
> ...
> <lst name="facet_fields">
>  <lst name="geo_locality">
>   <int name="7zzzzzzzzzz">660</int>
>   <int name="t4m70cmvej9">290</int>
>   <int name="t4187pnmky3">214</int>
>   <int name="t441z6vwv3j">179</int>
>   <int name="t4328x4s6dj">165</int>
>   <int name="t1c639yyxdr">143</int>
>    ...
>  </lst>
> </lst>
>
> Filtering by this hashes fails:
> http://localhost/solr/browse?&**q=&fq=geo_locality<http://localhost/solr/browse?&q=&fq=geo_locality>
> :"**t4m70cmvej9"
> java.lang.**IllegalArgumentException: missing parens: t4m70cmvej9
>
> How do I get the results of a single location using faceting?
> Any thoughts?
>
> Regards
> Chris
>
> --
> Christian Köhler
>
> Zoologisches Forschungsmuseum Alexander Koenig
> Leibniz-Institut für Biodiversität der Tiere
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
>
> Stiftung des öffentlichen Rechts
> Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
> --
> Zoologisches Forschungsmuseum Alexander Koenig
> - Leibniz-Institut für Biodiversität der Tiere -
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
>
> Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
>
--
Zoologisches Forschungsmuseum Alexander Koenig
- Leibniz-Institut für Biodiversität der Tiere -
Adenauerallee 160, 53113 Bonn, Germany
www.zfmk.de

Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
Sitz: Bonn

Re: Facet values for spacial field

Posted by Erick Erickson <er...@gmail.com>.
You might be able to facet by query, but faceting by
location fields doesn't make a huge amount of sense,
you'll have lots of facets on individual lat/lon points.

What is the use-case you are trying to support here?

Best,
Erick


On Tue, Sep 10, 2013 at 8:43 AM, Christian Köhler - ZFMK
<c....@zfmk.de>wrote:

> Hi,
>
> I use the new SpatialRecursivePrefixTreeFiel**dType field to store geo
> coordinates (e.g. 14.021666,51.5433353 ). I can retrieve the coordinates
> just find so I am sure they are indexed correctly.
>
> However when I try to create facets from this field, solr returns
> something which looks like a hash of the coordinates:
>
> Schema:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="example" version="1.5">
>   <types>
>    ...
>     <fieldType name="location"
>            class="solr.**SpatialRecursivePrefixTreeFiel**dType"
>            units="degrees" />
>     ...
>   <field name="geo_locality" type="location" indexed="true"
>          stored="true"  />
> </schema>
>
> Result:
> http://localhost/solr/browse?**facet=true&facet.field=geo_**locality<http://localhost/solr/browse?facet=true&facet.field=geo_locality>->
> ...
> <lst name="facet_fields">
>  <lst name="geo_locality">
>   <int name="7zzzzzzzzzz">660</int>
>   <int name="t4m70cmvej9">290</int>
>   <int name="t4187pnmky3">214</int>
>   <int name="t441z6vwv3j">179</int>
>   <int name="t4328x4s6dj">165</int>
>   <int name="t1c639yyxdr">143</int>
>    ...
>  </lst>
> </lst>
>
> Filtering by this hashes fails:
> http://localhost/solr/browse?&**q=&fq=geo_locality<http://localhost/solr/browse?&q=&fq=geo_locality>
> :"**t4m70cmvej9"
> java.lang.**IllegalArgumentException: missing parens: t4m70cmvej9
>
> How do I get the results of a single location using faceting?
> Any thoughts?
>
> Regards
> Chris
>
> --
> Christian Köhler
>
> Zoologisches Forschungsmuseum Alexander Koenig
> Leibniz-Institut für Biodiversität der Tiere
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
>
> Stiftung des öffentlichen Rechts
> Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
> --
> Zoologisches Forschungsmuseum Alexander Koenig
> - Leibniz-Institut für Biodiversität der Tiere -
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
>
> Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
>

Re: Facet values for spacial field

Posted by Upayavira <uv...@odoko.co.uk>.
Note that Solr facets on the *indexed* value, not the stored one. If you
want to facet on the points themselves, store them in your index
alongside as a 'string' field, and facet on that. But as Erick says,
that might give you rather a lot of facets, unless things tend to be
grouped by location.

Upayavira

On Tue, Sep 10, 2013, at 01:43 PM, Christian Köhler - ZFMK wrote:
> Hi,
> 
> I use the new SpatialRecursivePrefixTreeFieldType field to store geo
> coordinates (e.g. 14.021666,51.5433353 ). I can retrieve the coordinates
> just find so I am sure they are indexed correctly.
> 
> However when I try to create facets from this field, solr returns
> something which looks like a hash of the coordinates:
> 
> Schema:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="example" version="1.5">
>    <types>
>     ...
>      <fieldType name="location"
>             class="solr.SpatialRecursivePrefixTreeFieldType"
>             units="degrees" />
>      ...
>    <field name="geo_locality" type="location" indexed="true"
>           stored="true"  />
> </schema>
> 
> Result:
> http://localhost/solr/browse?facet=true&facet.field=geo_locality ->
> ...
> <lst name="facet_fields">
>   <lst name="geo_locality">
>    <int name="7zzzzzzzzzz">660</int>
>    <int name="t4m70cmvej9">290</int>
>    <int name="t4187pnmky3">214</int>
>    <int name="t441z6vwv3j">179</int>
>    <int name="t4328x4s6dj">165</int>
>    <int name="t1c639yyxdr">143</int>
>     ...
>   </lst>
> </lst>
> 
> Filtering by this hashes fails:
> http://localhost/solr/browse?&q=&fq=geo_locality:"t4m70cmvej9"
> java.lang.IllegalArgumentException: missing parens: t4m70cmvej9
> 
> How do I get the results of a single location using faceting?
> Any thoughts?
> 
> Regards
> Chris
> 
> --
> Christian Köhler
> 
> Zoologisches Forschungsmuseum Alexander Koenig
> Leibniz-Institut für Biodiversität der Tiere
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
> 
> Stiftung des öffentlichen Rechts
> Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn
> --
> Zoologisches Forschungsmuseum Alexander Koenig
> - Leibniz-Institut für Biodiversität der Tiere -
> Adenauerallee 160, 53113 Bonn, Germany
> www.zfmk.de
> 
> Stiftung des öffentlichen Rechts; Direktor: Prof. J. Wolfgang Wägele
> Sitz: Bonn