Ahmet, I got it working to an extent.
Now: SolrQuery query = new SolrQuery(); query.setQueryType("dismax"); query.setQuery( "kitten"); query.setParam("qf", "title"); QueryResponse rsp = server.query( query ); List<SOLRTitle> beans = rsp.getBeans(SOLRTitle.class); System.out.println(beans.size()); Iterator<SOLRTitle> it = beans.iterator(); while(it.hasNext()) { SOLRTitle solrTitle = (SOLRTitle)it.next(); System.out.println(solrTitle.id); System.out.println(solrTitle.title); } *This code is able to find the record, and prints the ID. But fails to print the Title.* Whereas: SolrQuery query = new SolrQuery(); query.setQuery( "title:kitten" ); QueryResponse rsp = server.query( query ); SolrDocumentList docs = rsp.getResults(); Iterator<SolrDocument> iter = rsp.getResults().iterator(); while (iter.hasNext()) { SolrDocument resultDoc = iter.next(); String title = (String) resultDoc.getFieldValue(" title"); String id = (String) resultDoc.getFieldValue("id"); //id is the uniqueKey field System.out.println(id); System.out.println(title); } * This query succeeds!* What am I doing wrong in dismax params? The title field is being fetched as Null. Regards, Subhash Bhushan. On Fri, Oct 8, 2010 at 2:05 PM, Ahmet Arslan <iori...@yahoo.com> wrote: > > I have two fields in the bean class, id and title. > > After adding the bean to SOLR, I want to search for, say > > "kitten", in all > > defined fields in the bean, like this -- query.setQuery( > > "kitten"); -- > > But I get results only when I affix the bean field name > > before the search > > text like this -- query.setQuery( "title:kitten"); -- > > > > Same case even when I use SolrInputDocument, and add these > > fields. > > > > Can we search text in all fields of a bean, without having > > to specify a > > field? > > With dismax, you can query several fields using different boosts. > http://wiki.apache.org/solr/DisMaxQParserPlugin > > > > >