2015-04-27 19:22 GMT+02:00 Alessandro Benedetti <benedetti.ale...@gmail.com>
:

> Just had the very same problem, and I confirm that currently is quite a
> mess to manage suggestions in SolrJ !
> I have to go with manual Json parsing.
>

or very not nice NamedList API mess (see an example in JR Oak [1][2]).

Regards,
Tommaso

p.s.:
note that this applies to Solr 4.7.1 API, but reading the thread it seems
the problem is still there.

[1] :
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndex.java#L318
[2] :
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndex.java#L370



>
> Cheers
>
> 2015-02-02 12:17 GMT+00:00 Jan Høydahl <jan....@cominvent.com>:
>
> > Using the /suggest handler wired to SuggestComponent, the
> > SpellCheckResponse objects are not populated.
> > Reason is that QueryResponse looks for a top-level element named
> > "spellcheck"
> >
> >       else if ( "spellcheck".equals( n ) )  {
> >         _spellInfo = (NamedList<Object>) res.getVal( i );
> >         extractSpellCheckInfo( _spellInfo );
> >       }
> >
> > Earlier the suggester was the same as the Spell component, but now with
> > its own component, suggestions are put in "suggest".
> >
> > I think we're lacking a SuggestResponse.java for parsing suggest
> > responses..??
> >
> > --
> > Jan Høydahl, search solution architect
> > Cominvent AS - www.cominvent.com
> >
> > > 26. sep. 2014 kl. 07.27 skrev Clemens Wyss DEV <clemens...@mysign.ch>:
> > >
> > > Thx to you two.
> > >
> > > Just in case anybody else is trying to do "this". The following SolrJ
> > code corresponds to the http request
> > > GET http://localhost:8983/solr/solrpedia/suggest?q=atmo
> > > of  "Solr in Action" (chapter 10):
> > > ...
> > > SolrServer server = new HttpSolrServer("
> > http://localhost:8983/solr/solrpedia";);
> > > SolrQuery query = new SolrQuery( "atmo" );
> > > query.setRequestHandler( "/suggest" );
> > > QueryResponse queryresponse = server.query( query );
> > > ...
> > > queryresponse.getSpellCheckResponse().getSuggestions();
> > > ...
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Shawn Heisey [mailto:s...@elyograg.org]
> > > Gesendet: Donnerstag, 25. September 2014 17:37
> > > An: solr-user@lucene.apache.org
> > > Betreff: Re: /suggest through SolrJ?
> > >
> > > On 9/25/2014 8:43 AM, Erick Erickson wrote:
> > >> You can call anything from SolrJ that you can call from a URL.
> > >> SolrJ has lots of convenience stuff to set particular parameters,
> > >> parse the response, etc... But in the end it's communicating with Solr
> > >> via a URL.
> > >>
> > >> Take a look at something like SolrQuery for instance. It has a nice
> > >> command setFacetPrefix. Here's the entire method:
> > >>
> > >> public SolrQuery setFacetPrefix( String field, String prefix ) {
> > >>    this.set( FacetParams.FACET_PREFIX, prefix );
> > >>    return this;
> > >> }
> > >>
> > >> which is really
> > >>    this.set( "facet.prefix", prefix ); All it's really doing is
> > >> setting a SolrParams key/value pair which is equivalent to
> > >> &facet.prefix=blahblah on a URL.
> > >>
> > >> As I remember, there's a "setPath" method that you can use to set the
> > >> destination for the request to "suggest" (or maybe "/suggest"). It's
> > >> something like that.
> > >
> > > Yes, like Erick says, just use SolrQuery for most accesses to Solr on
> > arbitrary URL paths with arbitrary URL parameters.  The "set" method is
> how
> > you include those parameters.
> > >
> > > The SolrQuery method Erick was talking about at the end of his email is
> > setRequestHandler(String), and you would set that to "/suggest".  Full
> > disclosure about what this method actually does: it also sets the "qt"
> > > parameter, but with the modern example Solr config, the qt parameter
> > doesn't do anything -- you must actually change the URL path on the
> > request, which this method will do if the value starts with a forward
> slash.
> > >
> > > Thanks,
> > > Shawn
> > >
> >
> >
>
>
> --
> --------------------------
>
> Benedetti Alessandro
> Visiting card : http://about.me/alessandro_benedetti
>
> "Tyger, tyger burning bright
> In the forests of the night,
> What immortal hand or eye
> Could frame thy fearful symmetry?"
>
> William Blake - Songs of Experience -1794 England
>

Reply via email to