See Javadocs of QueryParser:

NOTE: You must specify the required Version compatibility when creating 
QueryParser:
- As of 3.1, QueryParserBase.setAutoGeneratePhraseQueries(boolean) is false by 
default.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Chris Salem [mailto:csa...@mainsequence.net]
> Sent: Tuesday, August 12, 2014 2:34 PM
> To: java-user@lucene.apache.org
> Subject: RE: escaping characters
> 
> Thanks!  That worked.
> 
> We recently upgraded from 2.9 to 4.9, was true the default in 2.9?
> 
> -----Original Message-----
> From: Jack Krupansky [mailto:j...@basetechnology.com]
> Sent: Monday, August 11, 2014 5:54 PM
> To: java-user@lucene.apache.org
> Subject: Re: escaping characters
> 
> 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.
> 
> See:
> http://lucene.apache.org/core/4_9_0/queryparser/org/apache/lucene/quer
> yparser/classic/QueryParserBase.html#setAutoGeneratePhraseQueries(boo
> lean)
> 
> -- Jack Krupansky
> 
> -----Original Message-----
> From: Chris Salem
> Sent: Monday, August 11, 2014 1:03 PM
> To: java-user@lucene.apache.org
> Subject: RE: escaping characters
> 
> 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
> 
> 
> ---------------------------------------------------------------------
> 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


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