lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fran├žois Schiettecatte <fschietteca...@gmail.com>
Subject Re: setQuery in SolrJ
Date Mon, 02 Sep 2013 12:25:57 GMT
Shouldn't the search be more like this if you are searching in the 'descricaoRoteiro' field:

	descricaoRoteiro:(BPS 8D BEACH*)

or in your example you have a space in between 'descricaoRoteiro' and 'BPS':

	descricaoRoteiro:BPS 8D BEACH*

Fran├žois


On Sep 2, 2013, at 8:08 AM, Dmitry Kan <solrexpert@gmail.com> wrote:

> Hi,
> 
> What's your default query field in solrconfig.xml?
> 
> <requestHandler name="/select" class="solr.SearchHandler">
> <str name="df">[WHAT IS IN HERE?]</str>
> 
> I think what's happening is that the query:
> 
> (descricaoRoteiro: BPS 8D BEACH*)
> 
> gets interpreted as:
> 
> descricaoRoteiro:BPS (8D BEACH*)
> 
> then on the (8D BEACH*) a default field name is applied.
> 
> You can use debugQuery parameter to see how the query was parsed.
> 
> HTH,
> Dmitry
> 
> 
> On Mon, Sep 2, 2013 at 2:53 PM, Sergio Stateri <stateri@gmail.com> wrote:
> 
>> hi,
>> 
>> How can I looking for an exact phrase in query.setQuery method (SolrJ)?
>> 
>> Like this:
>> 
>> SolrQuery query = new SolrQuery();
>> query.setQuery( "(descricaoRoteiro: BPS 8D BEACH*)" );
>> query.set("start", "200");
>> query.set("rows", "10");
>> query.addField("descricaoRoteiro");
>> QueryResponse rsp = server.query( query );
>> 
>> 
>> When I run this code, the following exception is thrown:
>> 
>> Exception in thread "main"
>> org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: no
>> field name specified in query and no default specified via 'df' param
>> at
>> 
>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:424)
>> at
>> 
>> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
>> at
>> 
>> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
>> at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
>> at
>> 
>> com.teste.SearchRoteirosFromCollection.extrairEApresentarResultados(SearchRoteirosFromCollection.java:65)
>> ...
>> 
>> 
>> But If I search one a word od put * between two words, the search works
>> fine.
>> 
>> 
>> Thanks in advance,
>> 
>> 
>> --
>> Sergio Stateri Jr.
>> stateri@gmail.com
>> 


Mime
View raw message