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 Giovanni Gherdovich <g....@gmail.com> on 2012/06/30 13:15:00 UTC
how to retrieve a doc from its docID ?
Hi all,
when querying my solr instance, the answers I get
are the document IDs of my docs. Here is how one of my docs
looks like:
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<add>
<doc>
<field name="text">hello solar!</field>
<field name="id">123</field>
</doc>
</add>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
here is the response if I query for "solar" :
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<response>
<lst name="responseHeader"></lst>
<result name="response" numFound="1" start="0" maxScore="1.0">
<doc><float name="score">1.0</float>
<str name="id">123</str></doc>
</result>
</response>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
which is, solr gives me the doc ID. How to retrieve the doc's field "text"
given its id ?
cheers,
Giovanni
Re: how to retrieve a doc from its docID ?
Posted by Giovanni Gherdovich <g....@gmail.com>.
Sascha:
> You should also make sure that the field definition (in schema.xml) for 'text'
> says stored="true", otherwise the field will not be returned.
I guess you're hitting my problem.
The field I want to search on is declared with store=false in
the schema.xml:
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
<field name="text" type="text" indexed="true" stored="false"
multiValued="true"/>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
I guess I have to re-index all my corpus again,
after modifying that declaration in my schema.xml
(or choosing a different field in the example schema -- which one?)
Sascha:
> did you include the fl parameter in the Solr query URL?
> If that's the case make sure that the field name 'text' is mentioned there.
no, I am not using the "fiel list" (fl) param. should I?
Jack:
> Don't try doing this with the "text" field of the Solr example schema,
> copied to the catchall field. [...] he catchall field is designed for indexing,
> not result display.
Uhm... I am using the field 'text', which is of fieldType 'text',
from the example schema. I choosed it with no clue -- I guessed
what could have been the fields for my docs, and picked up that one.
Should I have made a different choice?
Are you saying that all fields then are "copied" into some "behind the scenes"
'text' field, and that is the real purpose of the following field
in the example schema?
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
<field name="text" type="text" indexed="true" stored="false"
multiValued="true"/>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8
Then, what is a better suited field from the pool of fields
that are available off-the-shelf in the example schema,
given that my goal is to make text searches into that field?
Jack:
> Rather, add the original source field(s)
> to "fl" that was/were copied to the catchall field.
If anything has been copied from a field to another,
this has happened beyond my intentions :-)
I picked up the 'text' field since I thought it was
good for text search. You're saying it isn't,
if I understand you correctly.
> But do make sure that "stored=true" for any field
> you want returned in search results.
ok noted.
cheers,
GGhh
Re: how to retrieve a doc from its docID ?
Posted by Jack Krupansky <ja...@basetechnology.com>.
Don't try doing this with the "text" field of the Solr example schema, which
is a catchall field that is populated via CopyFields. Rather, add the
original source field(s) to "fl" that was/were copied to the catchall field.
The catchall field is designed for indexing, not result display. But do
make sure that "stored=true" for any field you want returned in search
results.
-- Jack Krupansky
-----Original Message-----
From: Sascha Szott
Sent: Saturday, June 30, 2012 6:39 AM
To: solr-user@lucene.apache.org
Subject: Re: how to retrieve a doc from its docID ?
Hi,
did you include the fl parameter in the Solr query URL? If that's the case
make sure that the field name 'text' is mentioned there. You should also
make sure that the field definition (in schema.xml) for 'text' says
stored="true", otherwise the field will not be returned.
-Sascha
Giovanni Gherdovich <g....@gmail.com> schrieb:
Hi all,
when querying my solr instance, the answers I get
are the document IDs of my docs. Here is how one of my docs
looks like:
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<add>
<doc>
<field name="text">hello solar!</field>
<field name="id">123</field>
</doc>
</add>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
here is the response if I query for "solar" :
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<response>
<lst name="responseHeader"></lst>
<result name="response" numFound="1" start="0" maxScore="1.0">
<doc><float name="score">1.0</float>
<str name="id">123</str></doc>
</result>
</response>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
which is, solr gives me the doc ID. How to retrieve the doc's field "text"
given its id ?
cheers,
Giovanni
Re: how to retrieve a doc from its docID ?
Posted by Sascha Szott <sz...@gmx.de>.
Hi,
did you include the fl parameter in the Solr query URL? If that's the case make sure that the field name 'text' is mentioned there. You should also make sure that the field definition (in schema.xml) for 'text' says stored="true", otherwise the field will not be returned.
-Sascha
Giovanni Gherdovich <g....@gmail.com> schrieb:
Hi all,
when querying my solr instance, the answers I get
are the document IDs of my docs. Here is how one of my docs
looks like:
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<add>
<doc>
<field name="text">hello solar!</field>
<field name="id">123</field>
</doc>
</add>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
here is the response if I query for "solar" :
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
<response>
<lst name="responseHeader"></lst>
<result name="response" numFound="1" start="0" maxScore="1.0">
<doc><float name="score">1.0</float>
<str name="id">123</str></doc>
</result>
</response>
-- -- >8 -- -- >8 -- -- >8 -- -- >8 -- -- >8 -- --
which is, solr gives me the doc ID. How to retrieve the doc's field "text"
given its id ?
cheers,
Giovanni