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 evol__ <da...@gmail.com> on 2008/02/18 13:31:11 UTC

custom handler results don't seem to match manually entered query string

Hi,
my problem is as follows: my request handler's code

filters = null;
DocListAndSet docs_main = searcher.getDocListAndSet(query, filters, null,
start, rows, flags);
String querystr = query.toString();
rsp.add("QUERY_main", querystr);


gives zero responses:

 <str name="QUERY_main">((text:Travel text:Home text:Online_Archives
text:Ireland text:Consumer_Information text:Regional text:Europe text:News
text:Complaints text:CNN.com text:February text:Transport
text:Airlines)^0.3)</str>
 <result name="response" numFound="0" start="0" maxScore="0.0" /> 


While copying the "QUERY_main" string into Solr admin returns full of them:

<str name="q">
(text:Travel text:Home text:Online_Archives text:Ireland
text:Consumer_Information text:Regional text:Europe text:News
text:Complaints text:CNN.com text:February text:Transport text:Airlines)^0.3
</str>
<str name="rows">10</str>
<str name="version">2.2</str>
</lst>
</lst>
−
	<result name="response" numFound="71584" start="0">



Please help me understand what's going on, I'm a bit confused atm. Thanks
:-)

-- 
View this message in context: http://www.nabble.com/custom-handler-results-don%27t-seem-to-match-manually-entered-query-string-tp15544268p15544268.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: custom handler results don't seem to match manually entered query string

Posted by evol__ <da...@gmail.com>.
Can I provide some additional information of any kind?
-- 
View this message in context: http://www.nabble.com/custom-handler-results-don%27t-seem-to-match-manually-entered-query-string-tp15544268p15590448.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: custom handler results don't seem to match manually entered query string

Posted by Chris Hostetter <ho...@fucit.org>.
: But I always thought such code:
: 
: Term term = new Term("text", str);
: TermQuery tq = new TermQuery(term);
: query.add(tq, Occur.SHOULD);
: 
: would get query terms through analyzers - since they are specified under

the underlying lucene query classes (like TermQuery) don't know anything 
baout analyzers -- definitely nothing about Solr specific field types.

if you think about it: it would be impossible for them to: if you've got a 
quoted string like "foo bar" you need to analyze it in order to know 
wether it should be a single TermQuery (because of KeywordTokenizer), a 
PhraseQuery with two terms (because of whitespace tokenizer), a 
PhraseQuery with a dozen terms (because of an ngram tokenizer) or a 
MultiTermPrahseQuery (because of a synonym filter)

it's the SolrQueryParser that knows about the FieldTypes in the schema.xml



-Hoss


Re: custom handler results don't seem to match manually entered query string

Posted by evol__ <da...@gmail.com>.
Hoss thanks,
hm it might be a problem with not (specifically..) using analyzers.

But I always thought such code:

Term term = new Term("text", str);
TermQuery tq = new TermQuery(term);
query.add(tq, Occur.SHOULD);

would get query terms through analyzers - since they are specified under

<fieldType name="text" class="solr.TextField" positionIncrementGap="100"
omitNorms="false">
...
 <analyzer type="query">


Is that not true?


Cheers. D.


hossman wrote:
> 
> 
> Hmmm... everything seems right here.  
> 
> This may be a silly question, but 
> you are calling rsp.add("response", docs_main.docList) in your custom 
> handler correct?
> 
> second question: how are you building up your query obejct?  the only 
> thing i can think of is that you are constructing the TermQueries directly 
> (without using the analyzer) so they don't match what's really in the 
> index (ie: things aren't being lowercased, not splitting on "." and "_") 
> but when you cut/paste the query string into standard request handler it 
> uses the QueryParser which does the proper analysis.
> 
> what does debugQuery=true say about your query when you cut/paste the 
> query string?
> 
> can you post the full code of your custo mrequest handler?
> 
> 
> : Hi,
> : my problem is as follows: my request handler's code
> : 
> : filters = null;
> : DocListAndSet docs_main = searcher.getDocListAndSet(query, filters,
> null,
> : start, rows, flags);
> : String querystr = query.toString();
> : rsp.add("QUERY_main", querystr);
> : 
> : 
> : gives zero responses:
> : 
> :  <str name="QUERY_main">((text:Travel text:Home text:Online_Archives
> : text:Ireland text:Consumer_Information text:Regional text:Europe
> text:News
> : text:Complaints text:CNN.com text:February text:Transport
> : text:Airlines)^0.3)</str>
> :  <result name="response" numFound="0" start="0" maxScore="0.0" /> 
> : 
> : 
> : While copying the "QUERY_main" string into Solr admin returns full of
> them:
> : 
> : <str name="q">
> : (text:Travel text:Home text:Online_Archives text:Ireland
> : text:Consumer_Information text:Regional text:Europe text:News
> : text:Complaints text:CNN.com text:February text:Transport
> text:Airlines)^0.3
> : </str>
> : <str name="rows">10</str>
> : <str name="version">2.2</str>
> : </lst>
> : </lst>
> : ÿÿ
> : 	<result name="response" numFound="71584" start="0">
> : 
> : 
> : 
> : Please help me understand what's going on, I'm a bit confused atm.
> Thanks
> : :-)
> 
> -Hoss
> 
> 

-- 
View this message in context: http://www.nabble.com/custom-handler-results-don%27t-seem-to-match-manually-entered-query-string-tp15544268p15629988.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: custom handler results don't seem to match manually entered query string

Posted by Chris Hostetter <ho...@fucit.org>.
Hmmm... everything seems right here.  

This may be a silly question, but 
you are calling rsp.add("response", docs_main.docList) in your custom 
handler correct?

second question: how are you building up your query obejct?  the only 
thing i can think of is that you are constructing the TermQueries directly 
(without using the analyzer) so they don't match what's really in the 
index (ie: things aren't being lowercased, not splitting on "." and "_") 
but when you cut/paste the query string into standard request handler it 
uses the QueryParser which does the proper analysis.

what does debugQuery=true say about your query when you cut/paste the 
query string?

can you post the full code of your custo mrequest handler?


: Hi,
: my problem is as follows: my request handler's code
: 
: filters = null;
: DocListAndSet docs_main = searcher.getDocListAndSet(query, filters, null,
: start, rows, flags);
: String querystr = query.toString();
: rsp.add("QUERY_main", querystr);
: 
: 
: gives zero responses:
: 
:  <str name="QUERY_main">((text:Travel text:Home text:Online_Archives
: text:Ireland text:Consumer_Information text:Regional text:Europe text:News
: text:Complaints text:CNN.com text:February text:Transport
: text:Airlines)^0.3)</str>
:  <result name="response" numFound="0" start="0" maxScore="0.0" /> 
: 
: 
: While copying the "QUERY_main" string into Solr admin returns full of them:
: 
: <str name="q">
: (text:Travel text:Home text:Online_Archives text:Ireland
: text:Consumer_Information text:Regional text:Europe text:News
: text:Complaints text:CNN.com text:February text:Transport text:Airlines)^0.3
: </str>
: <str name="rows">10</str>
: <str name="version">2.2</str>
: </lst>
: </lst>
: ÿÿ
: 	<result name="response" numFound="71584" start="0">
: 
: 
: 
: Please help me understand what's going on, I'm a bit confused atm. Thanks
: :-)

-Hoss