Hi Niran,

No analysis is done with surround. For example if you have lowercase filter in 
your index analysis chain then 'Wuthering OR Heights' won't match. Try using 
'wuthering OR heights'.  Stemming can be problematic in this too.

See limitations in http://wiki.apache.org/solr/SurroundQueryParser

Ahmet

________________________________
 From: "Abeygunawardena, Niran" <niran.abeygunaward...@proquest.co.uk>
To: "solr-user@lucene.apache.org" <solr-user@lucene.apache.org> 
Sent: Wednesday, July 3, 2013 2:42 PM
Subject: Surround query parser not working?
 

Hi,

I have tried to get the surround query parser working against SOLR 4.3.0 and 
SOLR 4.0.0 but it does not seem to return any documents for me. I need this 
parser to make ordered proximity searches with the operator "W". I have tried 
the parser with normal boolean operators like OR and it still does not work for 
me. What am I doing wrong?

My example queries:
http://localhost:8983/solr/reference_core/keyword?q={!surround}Wuthering+OR+Heights&debug=true<http://localhost:8983/solr/reference_core/keyword?q=%7b!surround%7dWuthering+OR+Heights&debug=true>
http://localhost:8983/solr/reference_core/keyword?q=Wuthering+OR+Heights&debug=true&defType=surround
The response I get from the above queries:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
<lst name="params">
<str name="q">{!surround}Wuthering OR Heights</str>
<str name="debug">true</str>
</lst>
</lst>
<result name="response" numFound="0" start="0"/>
<lst name="debug">
<str name="rawquerystring">{!surround}Wuthering OR Heights</str>
<str name="querystring">{!surround}Wuthering OR Heights</str>
<str name="parsedquery">
SimpleTermRewriteQuery(org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(text,
 Wuthering, 
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries: 
1000, queriesMade: 0)))
                
SimpleTermRewriteQuery(org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(text,
 Heights, 
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries: 
1000, queriesMade: 0)))
</str>
<str name="parsedquery_toString">
org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(unused: 
)(text, Wuthering, 
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries: 
1000, queriesMade: 0))
org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(unused: 
)(text, Heights, 
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries: 
1000, queriesMade: 0))
</str>
<lst name="explain"/>
<str name="QParser">SurroundQParser</str>
<lst name="timing"></lst>
</lst>
</response>


Whereas the same query against the edismax query parser, I get back 756 docs:
http://localhost:8983/solr/reference_core/keyword?q=Wuthering+OR+Heights&debug=true
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">39</int>
<lst name="params">
<str name="q">Wuthering OR Heights</str>
<str name="debug">true</str>
</lst>
</lst>
<result name="response" numFound="756" start="0"></result>
<lst name="debug">
<str name="rawquerystring">Wuthering OR Heights</str>
<str name="querystring">Wuthering OR Heights</str>
<str name="parsedquery">
(+(DisjunctionMaxQuery((biobrand:wuther | ilcs_biog:wuther |....)))/no_coord
</str>
<str name="parsedquery_toString">
+((biobrand:wuther | ilcs_biog:wuther | comhd0:wuther | ....))
</str>
<lst name="explain"></lst>
<str name="QParser">ExtendedDismaxQParser</str>
<null name="altquerystring"/>
<null name="boost_queries"/>
<arr name="parsed_boost_queries"/>
<null name="boostfuncs"/>
<lst name="timing"></lst>
</lst>
</response>



Any help is much appreciated.

Thanks,
Niran

Reply via email to