The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

boy18nj (112) [Avatar] Offline
#1
Since Lucene is new to me, I expect to run the code examples to understand clearly. To make sense out of new programs introduced, I need to run them.

Example-

public void testSlop() throws Exception {
Query q = new QueryParser(Version.LUCENE_30,
"field", analyzer)
.parse(""exact phrase"");
assertEquals("zero slop",
""exact phrase"", q.toString("field"));
QueryParser qp = new QueryParser(Version.LUCENE_30,
"field", analyzer);
qp.setPhraseSlop(5);
q = qp.parse(""sloppy phrase"");
assertEquals("sloppy, implicitly",
""sloppy phrase"~5", q.toString("field"));
}

Above code snippet is from Chapter-3, I could not find out this code anywhere in the source code attached, where can I locate this code?

Also if you run ant -p, you see different target's available, I cannot figure out which target belong to which chapter. It would be much appreciated if a list is provided which highlights this code refers to chapter,3,4,5 etc.

Please clear these 2 doubts, it is becoming so tough to understand from chapter-3 onwards.

Thanks
boy18nj (112) [Avatar] Offline
#2
Re: Difficulty in understanding Chapter-3
I would request authors if they can share light on this thread.
mike.mccandless (221) [Avatar] Offline
#3
Re: Difficulty in understanding Chapter-3
That test case is in lia/searching/QueryParserTest.java.

If you run "ant test -Dtest=QueryParser" then it will run the tests in that class.

Mike