lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: How to override special meaning of +
Date Tue, 11 Mar 2008 01:06:40 GMT
: a) hot+cold
: b) hot++cold
: c) hotcold
: d) hot cold
: e) cold water
: f) hot water
: I want to search only for hot+cold. I tried with "hot\+cold" and also
: hot\+cold. I got *first four* contents.
: How to search only exact match?

there are two issues to keep i mind here: one is the analyzer you choose 
for your fields -- for many tokenizers those "+" symbols will be split on 
and thrown away.  use the analysis tool to see exactly how those a-f 
values will get indexed.

second: "+" as you know is a special character -- but only if it is the 
first character in a string, if it appears in the middle it is not 
special.  In the standard request handler you can escape this special 
character with quoting or backslash escaping (but don't use both at the 
same time), in dismax the only way to escape it is by enclosing your 
string in quotes.

To debug how the query parser is dealing with your string and whether or 
not it's treating it as a special character, use the debugQuery=true 
option when you send your query and look at the "parsedquery_toString" 
output. query on a field that uses the KeywordAnalyzer so you can be 
confident that any changes you see to the string in parsedquery_toString 
are a result of the query parser and notthe analyzer.

: I have 2 field types, title :- which is supported by dismax.
: title_exact:- which does not supported by dismax. But only has
: KeywordTokenizer, and Lowercase.

i'm really not sure that that means ... there is no reason why you 
shouldn't be able to query your title_exact field with dismax


View raw message