Niran -

Looks like you're being bitten by a known "feature"* of the surround query 
parser.  It does not analyze the text, as some of the other more commonly used 
query parsers does.  The dismax, edismax, and "lucene" query parsers all 
leverage field analysis on the query terms or phrases.  The surround query 
parser just takes the terms as-is.  It's by design, but not necessarily 
something that can't at least be optionally available.  But as it is, you'll 
need to lowercase, at least.  Be careful with index-time stemming, as you'd 
have to account for that in the surround query parser syntax by wildcarding 
things a bit.  Instead of searching for "finding", one would use "find*" (and 
index without stemming) in the query to match "finds", "finding".  It was by 
design to not analyze in the surround query parser because it can be handy to 
use less analysis tricks at index time, and let the query itself be more 
sophisticated to allow more flexible and indeed more complex query-time 
constructs.

        Erik

* http://wiki.apache.org/solr/SurroundQueryParser#Limitations - though it'd be 
useful to have analysis at least optionally available.


On Jul 3, 2013, at 07:42 , Abeygunawardena, Niran wrote:

> 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