lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Pruitt <bpru...@opentext.com>
Subject RE: [EXTERNAL] - Re: Solr not returning stored field
Date Thu, 27 Jun 2019 18:46:10 GMT
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 <arafalov@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, <bpruitt@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".
>
Mime
View raw message