lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: prefix query help
Date Thu, 08 Dec 2016 17:51:41 GMT
On 12/8/2016 10:02 AM, KRIS MUSSHORN wrote:
>
> Here is how I have the field defined... see attachment.

You're using a tokenized field type.

For the kinds of queries you asked about here, you want to use StrField,
not TextField -- this type cannot have an analysis chain and indexes to
one token that is completely unchanged from the input.  Note that if you
also want to do other kinds of queries (like 2016), then StrField would
break those.  You do have to reindex after making this change.

Since your input data is consistently YYYY-MM-DD, you should consider
using the solr.DateRangeField class instead of a string or text type. 
This allows queries like "2016" or "2016-07" to work as you would expect
them to.

https://cwiki.apache.org/confluence/display/solr/Working+with+Dates#WorkingwithDates-DateRangeFormatting

Thanks,
Shawn


Mime
View raw message