lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: escaping characters
Date Mon, 11 Aug 2014 21:54:16 GMT
You need to manually enable automatic generation of phrase queries - it 
defaults to disabled, which simply treats the sub-terms as individual terms 
subject to the default operator.


-- Jack Krupansky

-----Original Message----- 
From: Chris Salem
Sent: Monday, August 11, 2014 1:03 PM
Subject: RE: escaping characters

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

FSDirectory fsd = File("C:\\indexes\\Lucene4"));

IndexReader reader =;

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


QueryParser qptemp = new QueryParser(Version.LUCENE_4_9, 

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

TopFieldCollector tfcollector = TopFieldCollector.create(new Sort(), 20, 
false, true, false, true);

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


-----Original Message-----
From: Erick Erickson []
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 

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


On Mon, Aug 11, 2014 at 8:54 AM, Chris Salem <>

> 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:
For additional commands, e-mail: 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message