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 Aleksander Stensby <al...@integrasco.com> on 2009/08/27 09:49:00 UTC

Trie Date question

Hello everyone,
after reading Grant's article about TrieRange capabilities on the lucid blog
I did some experimenting, but I have some trouble with the tdate type and I
was hoping that you guys could point me in the right direction.
So, basically I index a regular solr date field and use that for sorting and
range queries today. For experimenting I added tdate field, indexing it with
the same data as in my other date field, but I'm obviously doing something
wrong here, because the results coming back are completely different...
the definitions in my schema:
<field name="datetime" type="date" indexed="true" stored="false"
omitNorms="true"/>
<field name="tdatetime" type="tdate" indexed="true" stored="false"/>

so if I do a query on my test index:
q=datetime:[NOW/DAY-1YEAR TO NOW/DAY]
i get numFound="1031524" (don't worry about the ordering yet)..
then, if I do the following on my trie date field:
q=tdatetime:[NOW/DAY-1YEAR TO NOW/DAY]
i get numFound="0"
Where did I go wrong? (And yes, both fields are indexed with the exactly
same data...)
Thanks for any guidance here!
Cheers,
 Aleks

-- 
Aleksander M. Stensby
Lead Software Developer and System Architect
Integrasco A/S
www.integrasco.com
http://twitter.com/Integrasco
http://facebook.com/Integrasco

Please consider the environment before printing all or any of this e-mail

Re: Trie Date question

Posted by Aleksander Stensby <al...@integrasco.com>.
Thanks for the reply Yonik!
I'm using the nightly from 2009-08-20, so its a rather fresh build. And by
comparing the schema with the one im using now I had made a mistake when
defining the field.
By examining the most recent build, i noticed that the normal date field is
defined as follows:
<fieldType name="date" class="solr.TrieDateField" omitNorms="true"
precisionStep="0" positionIncrementGap="0"/>
(its actually a TrieDateField? does this mean that we are moving away from
the standard SolrDateField ?)
and that the tdate is specified as follows:
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"
precisionStep="6" positionIncrementGap="0"/>
I'll update my schema definitions and reindex:) Guess that pretty much will
solve my problems.
Thanks!
 Aleks

On Thu, Aug 27, 2009 at 3:47 PM, Yonik Seeley <yo...@lucidimagination.com>wrote:

> I can't reproduce any problem.
>
> Are you using a recent nightly build?
> See the example schema of a recent nightly build for the correct way
> to define a Trie based field - the article / blog may be out of date.
>
> Here's what I used to test the example data:
>
> http://localhost:8983/solr/select?q=manufacturedate_dt:[NOW/DAY-4YEAR%20TO%20NOW/DAY]
>
> -Yonik
> http://www.lucidimagination.com
>
>
>
> On Thu, Aug 27, 2009 at 3:49 AM, Aleksander
> Stensby<al...@integrasco.com> wrote:
> > Hello everyone,
> > after reading Grant's article about TrieRange capabilities on the lucid
> blog
> > I did some experimenting, but I have some trouble with the tdate type and
> I
> > was hoping that you guys could point me in the right direction.
> > So, basically I index a regular solr date field and use that for sorting
> and
> > range queries today. For experimenting I added tdate field, indexing it
> with
> > the same data as in my other date field, but I'm obviously doing
> something
> > wrong here, because the results coming back are completely different...
> > the definitions in my schema:
> > <field name="datetime" type="date" indexed="true" stored="false"
> > omitNorms="true"/>
> > <field name="tdatetime" type="tdate" indexed="true" stored="false"/>
> >
> > so if I do a query on my test index:
> > q=datetime:[NOW/DAY-1YEAR TO NOW/DAY]
> > i get numFound="1031524" (don't worry about the ordering yet)..
> > then, if I do the following on my trie date field:
> > q=tdatetime:[NOW/DAY-1YEAR TO NOW/DAY]
> > i get numFound="0"
> > Where did I go wrong? (And yes, both fields are indexed with the exactly
> > same data...)
> > Thanks for any guidance here!
> > Cheers,
> >  Aleks
> >
> > --
> > Aleksander M. Stensby
> > Lead Software Developer and System Architect
> > Integrasco A/S
> > www.integrasco.com
> > http://twitter.com/Integrasco
> > http://facebook.com/Integrasco
> >
> > Please consider the environment before printing all or any of this e-mail
> >
>



-- 
Aleksander M. Stensby
Lead Software Developer and System Architect
Integrasco A/S
www.integrasco.com
http://twitter.com/Integrasco
http://facebook.com/Integrasco

Please consider the environment before printing all or any of this e-mail

Re: Trie Date question

Posted by Yonik Seeley <yo...@lucidimagination.com>.
I can't reproduce any problem.

Are you using a recent nightly build?
See the example schema of a recent nightly build for the correct way
to define a Trie based field - the article / blog may be out of date.

Here's what I used to test the example data:
http://localhost:8983/solr/select?q=manufacturedate_dt:[NOW/DAY-4YEAR%20TO%20NOW/DAY]

-Yonik
http://www.lucidimagination.com



On Thu, Aug 27, 2009 at 3:49 AM, Aleksander
Stensby<al...@integrasco.com> wrote:
> Hello everyone,
> after reading Grant's article about TrieRange capabilities on the lucid blog
> I did some experimenting, but I have some trouble with the tdate type and I
> was hoping that you guys could point me in the right direction.
> So, basically I index a regular solr date field and use that for sorting and
> range queries today. For experimenting I added tdate field, indexing it with
> the same data as in my other date field, but I'm obviously doing something
> wrong here, because the results coming back are completely different...
> the definitions in my schema:
> <field name="datetime" type="date" indexed="true" stored="false"
> omitNorms="true"/>
> <field name="tdatetime" type="tdate" indexed="true" stored="false"/>
>
> so if I do a query on my test index:
> q=datetime:[NOW/DAY-1YEAR TO NOW/DAY]
> i get numFound="1031524" (don't worry about the ordering yet)..
> then, if I do the following on my trie date field:
> q=tdatetime:[NOW/DAY-1YEAR TO NOW/DAY]
> i get numFound="0"
> Where did I go wrong? (And yes, both fields are indexed with the exactly
> same data...)
> Thanks for any guidance here!
> Cheers,
>  Aleks
>
> --
> Aleksander M. Stensby
> Lead Software Developer and System Architect
> Integrasco A/S
> www.integrasco.com
> http://twitter.com/Integrasco
> http://facebook.com/Integrasco
>
> Please consider the environment before printing all or any of this e-mail
>