Try WhitespaceAnalyzer for both indexing and searching.
On search-time you may also need to escape "+", "(", ")" with "\".
"#" shouldn't need escaping.

On Thu, Jul 16, 2009 at 17:23, Chris Salem<ch...@mainsequence.net> wrote:
> I'm using the StandardAnalyzer for both searching and indexing.
> Here's the code to parse the query:
> Searcher searcher = new IndexSearcher(reader);
> Analyzer analyzer = new StandardAnalyzer(stopwords);
> System.out.println(queryString);
> QueryParser qp = new QueryParser(searchField,analyzer);
> Query query = qp.parse(queryString);
> queryString = query.toString();
> System.out.println(queryString);
> And here's the output from the println's:
> r2_resume_text:c\+\+ AND r2_resume_text: c\#
> +r2_resume_text:c +r2_resume_text:c
> Also the documentation doesn't say anything about # having to be escaped.
> Do I have to escape during indexing too?
> Sincerely,
> Chris Salem
>
>
>
> ----- Original Message -----
> To: java-user@lucene.apache.org, Chris Salem <ch...@mainsequence.net>
> From: Ian Lea <ian....@gmail.com>
> Sent: 7/16/2009 5:12:53 AM
> Subject: Re: searching for c++, c#, etc...
>
>
> Hi
>
>
> Escaping should work. See
> http://lucene.apache.org/java/2_4_1/queryparsersyntax.html and
> QueryParser.escape(). And you need to be sure that your analyzer
> isn't removing the plus signs and that you use the same analyzer for
> indexing and searching.
>
> Googling for something like "lucene escape" will find you more info.
>
> Luke will tell you what is actually in your index.
>
>
> --
> Ian.
>
>
> On Wed, Jul 15, 2009 at 5:19 PM, Chris Salem<ch...@mainsequence.net> wrote:
>> Hello,
>> I'm trying to search for the terms like c++ but the parser is stripping off 
>> the ++.  I tried escaping the ++ with slashes but it's still stripping it 
>> off.  I could replace + with "plus", is that the best way to do it?  How 
>> come escaping isn't working?
>> thanks
>> Sincerely,
>> Chris Salem
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to