Ok.  When something makes no sense.  Go back to the very beginning.  I was 
using an out of date configuration file which pointed SolrJ to another running 
Solr that had a core similar enough to the one running on localhost that I 
could not see an issue... until I checked everything.

All is good.

-S

-----Original Message-----
From: Steve Pruitt <bpru...@opentext.com> 
Sent: Thursday, June 27, 2019 2:46 PM
To: solr-user@lucene.apache.org
Subject: RE: [EXTERNAL] - Re: Solr not returning stored field

Ok, I am totally confused.

It works fine using Solr Admin console on some test cases.  I set the fl box 
with ranking reference and I get back both fields.

For completeness, I clicked the url constructed for the query and it works fine 
too.
Example: 
http://localhost:8983/solr/suggestion/select?fl=ranking%20reference&q=user:100000456

Here is the confusing part.
I stepped through my code, as I looped through the returned documents I copied 
the user value from the response and pasted user:value into the Admin console 
and get no results.  Yet, in my code using SolrQuery I see a response for the 
same user:value with the ranking field.

This makes no sense to me.  The Admin console is usually the source of truth.  
Why would I get no response from the console, but see a response using SolrJ?


-----Original Message-----
From: Alexandre Rafalovitch <arafa...@gmail.com>
Sent: Thursday, June 27, 2019 1:44 PM
To: solr-user <solr-user@lucene.apache.org>
Subject: [EXTERNAL] - Re: Solr not returning stored field

(If no other SolrJ specific advice shows up)....

Can you divide the problem in a middle a see what happens and whether the issue 
is Solr or SolrJ side.

Specifically, execute the query directly against Solr and see what happens.

Also I would triple-check that the documents you are getting back actually have 
the field. Sometimes not all documents do and the query returns those wirhout 
first. Cross check by getting returned IDs and looking up the full record 
directly in Solr.

Regards,
    Alex

On Thu, Jun 27, 2019, 1:37 PM Steve Pruitt, <bpru...@opentext.com> wrote:

> I cannot get Solr to return a stored field.
>
> My schema is:
>
> :
> <field name="user" type="plong" indexed="true" stored="true"/> <field 
> name="ranking" type="pdouble" indexed="false" stored="true"/> <field 
> name="reference" type="string" indexed="false" stored="true"/>
> :
>
> I am using the SolrJ client and trying this:
>
> The query string contains = " user: " and a list of user field values; 
> The query executes ok.  I get several documents.
>
> SolrQuery solrQuery = new SolrQuery(query); 
> solrQuery.setSort("ranking" , SolrQuery.ORDER.desc); 
> solrQuery.addField("ranking"); solrQuery.addField("reference");
>
> I also tried:
>
> solrQuery.setFields("ranking", " reference");
>
> But the result has only the "ranking" field.
> Before explicitly setting the fields.  All fields came back in 
> response except "reference".
>

Reply via email to