I'm not using Solr.  Here's my code:

FSDirectory fsd = FSDirectory.open(new File("C:\\indexes\\Lucene4"));
                        
IndexReader reader = DirectoryReader.open(fsd);

IndexSearcher searcher = new IndexSearcher(reader);
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_4_9, getStopWords());

BooleanQuery.setMaxClauseCount(100000);

QueryParser qptemp = new QueryParser(Version.LUCENE_4_9, 
"resume_text",analyzer);
qptemp.setAllowLeadingWildcard(true);
qptemp.setDefaultOperator(QueryParser.AND_OPERATOR);

Query querytemp = qptemp.parse("resume_text: (LS\\/MS)");       

System.out.println(querytemp.toString());
TopFieldCollector tfcollector = TopFieldCollector.create(new Sort(), 20, false, 
true, false, true);

ScoreDoc[] hits;
searcher.search(querytemp, tfcollector);
hits = tfcollector.topDocs().scoreDocs;
long resultCount = tfcollector.getTotalHits();

reader.close();



-----Original Message-----
From: Erick Erickson [mailto:erickerick...@gmail.com] 
Sent: Monday, August 11, 2014 12:27 PM
To: java-user
Subject: Re: escaping characters

Take a look at the adnim/analysis page for the field in question.
The next bit of critical information is adding & debug=query to the URL. The 
former will tell you what happens to the input stream at query and index time, 
the latter will tell you how the query got through the query parsing process.

My guess is that you have WordDelimiterFilterFactory in your analysis chain and 
that's breaking things up.

Best,
Erick


On Mon, Aug 11, 2014 at 8:54 AM, Chris Salem <csa...@mainsequence.net>
wrote:

> Hi everyone,
>
>
>
> I'm trying to escape special characters and it doesn't seem to be working.
> If I do a search like resume_text: (LS\/MS) it searches for LS AND MS 
> instead of LS/MS.  How would I escape the slash so it searches for LS/MS?
>
> Thanks
>
>
>
>


---------------------------------------------------------------------
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