lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Salem" <>
Subject RE: escaping characters
Date Mon, 11 Aug 2014 17:03:29 GMT
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, getStopWords());


QueryParser qptemp = new QueryParser(Version.LUCENE_4_9, "resume_text",analyzer);

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

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

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

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:

View raw message