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 stockii <st...@shopgate.com> on 2010/09/02 21:39:49 UTC
Purpose of SolrDocument.java
I worling through the SolrCode and i want to know how the class SolrDocument
used in Solr !?
When i start and debug a normal search, SolrDocument never been used.
(Standard SearchHandler with q-Query). i thought, this class is a
representation of a Doc from the Index as a higher level doc above the
lucene doc.
so i thougt that solr convert a lucene doc to a SolrDoc and work with this.
but solr doing an prefetch with DocSllice/DocSet/DocList ... an get the real
lucene doc in the XML-Writer for the response.
So for what is SolrDocument ????
thxxxx
--
View this message in context: http://lucene.472066.n3.nabble.com/Purpose-of-SolrDocument-java-tp1408443p1408443.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Purpose of SolrDocument.java
Posted by Peter Karich <pe...@yahoo.de>.
> aaah okay.
>
> so its SolrDocument in "normal" search never been used ? its only for other
> solr-plugins ?
>
SolrDocument is under org.apache.solr.common which is for the
solr-solj.jar and not available for the solr-core.jar
see e.g.:
http://lucene.apache.org/solr/api/org/apache/solr/common/SolrDocument.html
http://www.jarvana.com/jarvana/view/org/apache/solr/solr-solrj/1.4.1/solr-solrj-1.4.1.jar!/org/apache/solr/common/SolrDocument.class?classDetails=ok
So, yes. I think, it is only for solrj ('handle queries + responses in
pure Java')
Regards,
Peter.
--
http://jetwick.com twitter search prototype
Re: Purpose of SolrDocument.java
Posted by stockii <st...@shopgate.com>.
aaah okay.
so its SolrDocument in "normal" search never been used ? its only for other
solr-plugins ?
--
View this message in context: http://lucene.472066.n3.nabble.com/Purpose-of-SolrDocument-java-tp1408443p1411276.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Purpose of SolrDocument.java
Posted by Peter Karich <pe...@yahoo.de>.
Hi,
you can use it via SolrJ:
QueryResponse rsp = solrServer.query(query);
SolrDocumentList docs = rsp.getResults();
for (SolrDocument doc : docs) {
long id = (Long) doc.getFieldValue("id");
// create your higher level object here ...
}
SolrJ get the docs either from xml or binary stream (from a remote
connection to a solr server) depending on what you have set at
initialization time:
solrServer.setParser(new BinaryResponseParser());
Regards,
Peter.
> I worling through the SolrCode and i want to know how the class SolrDocument
> used in Solr !?
>
> When i start and debug a normal search, SolrDocument never been used.
> (Standard SearchHandler with q-Query). i thought, this class is a
> representation of a Doc from the Index as a higher level doc above the
> lucene doc.
>
> so i thougt that solr convert a lucene doc to a SolrDoc and work with this.
> but solr doing an prefetch with DocSllice/DocSet/DocList ... an get the real
> lucene doc in the XML-Writer for the response.
>
> So for what is SolrDocument ????
>
> thxxxx
>
--
http://jetwick.com twitter search prototype