lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dotan Cohen <>
Subject Re: After adding field to schema, the field is not being returned in results.
Date Fri, 02 Nov 2012 14:01:09 GMT
On Thu, Nov 1, 2012 at 9:09 PM, Erick Erickson <> wrote:
> What happens if you sort ascending rather than descending? Depending on
> what (if anything) you've done with sortMissingFirst/Last on that field,
> it's possible that you're just seeing the results of the sort and docs with
> your new field are somewhere down the list. If you've done nothing, you
> should be seeing the docs with the new field at the top of the list  with
> the query you posted, so this is grasping at straws a bit.

Thanks.  Sorting ASC or DESC still does not show the field, even in
documents for which the field should exist based on the time that it
was created. However, I am starting to wonder that perhaps my
application is creating the wrong field values and perhaps that is why
the field don't exist. This is the field in question:
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"
precisionStep="6" positionIncrementGap="0"/>
<field name="created_iso8601" type="tdate" stored="true"
multiValued="false" indexed="true"/>

My application is writing dates in this format (ISO 8601):

Here is the PHP code:

I am setting the server timezone, as PHP >= 5.1 requires:

> The solr admin page, try going to collection>>schema browser and choose the
> field in question from your drop-down. see if it looks like it is stored
> and indexed, and see what some of the values are. This is getting the vals
> from the indexed terms, but at least it should say "stored" in the schema
> and index sections. If it doesn't, then you somehow have a mismatch between
> your schema and what's actually in your index. This really shouldn't be the
> case since it's a brand-new field....

Sorry, no Term Info available :(

Alright, so it is an issue with the data that I'm feeding it. Would
Solr include the fields with good data and reject the fields with bad
data, but update the Document anyway? I can confirm that the variable
used to populate the field in question is not empty.

> Two other things I'd try.
> 1> If you have the ID of the document you're _sure_ has a date field in it
> try your query just on that, with fl=*. This would avoid any possible
> sortMissingFirst/Last issues.

Yes, I've done that, with and without fl.

> 2> Another way to restrict this would be to add an "fq" clause to the query
> so docs without the field would not be displayed, something like
> fq=[NOW-1YEAR TO NOW] assuming your dates are in the last year.
> But I guess we're down to needing to see the schema definition etc. if that
> doesn't work.
> Best
> Erick

Thanks, Erick. It does look like the issue is that the field remains
empty. Perhaps I'm writing ISO 8601 wrong, I'll get to looking at that
now. I'm surprised that Solr accepts the documents with bad data in
some of the fields, I will look into that too as well.

Have a peaceful Saturday.

Dotan Cohen

View raw message