Hi Grant, Thanks for the advice.. It turns out it was all my own stupidity,, I had commented out (for whatever reason) setPositionIncrement(0) on my synonym analyzer..
Cheers, Spence On 8/23/07, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > I would suggest starting with: http://wiki.apache.org/lucene-java/ > LuceneFAQ#head-3558e5121806fb4fce80fc022d889484a9248b71 especially > the part on Luke. > > Luke will let you try out the various queries and show you what they > look like before being submitted. > > Cheers, > Grant > > On Aug 23, 2007, at 3:04 PM, Spencer Tickner wrote: > > > Hi List, > > > > Thanks in advance for the help. I'm creating a simple searching test > > based on Query Parser and from what I've read it should have no > > problems with a Phrase Search. However I can't seem to get any results > > back. > > > > I'm doing a simple index using the StandardAnalyzer. Output from the > > indexing gives: > > ....... > > stored/uncompressed,indexed,tokenized<title:Auditor General Act> > > ...... > > > > I then have a simpleSearch class: > > > > public class SimpleSearch { > > > > public Hits doSearch(String term, String field) throws IOException, > > CorruptIndexException, ParseException { > > FSDirectory directory = > > FSDirectory.getDirectory("<path_to_index>"); > > IndexSearcher searcher = new IndexSearcher(directory); > > IndexReader reader; > > reader = IndexReader.open(directory); > > QueryParser parser = new QueryParser(field, new > > StandardAnalyzer()); > > Query query =parser.parse(term); > > // Just a couple of tests to see if I can figure out what's > > going on > > System.out.println(query.toString() + "\n"); > > System.out.println(query.rewrite(reader).toString() + "\n"); > > return searcher.search(query); > > } > > > > public static void main(String[] args) { > > SimpleSearch obj = new SimpleSearch(); > > String strQuery = "Auditor General"; > > Hits hits; > > try { > > hits = obj.doSearch(strQuery, "title"); > > } catch (Exception e) { > > System.out.println("Error1: " + e.getMessage()); > > return; > > } > > Document doc; > > for (int i = 0; i < hits.length(); i++) { > > > > try { > > doc = hits.doc(i); > > } catch (Exception e) { > > System.out.println("Error2: " + > > e.getMessage()); > > return; > > } > > System.out.println(doc.get("title")); > > } > > > > } > > } > > > > When strQuery = "Auditor General" I get hits back as expected. However > > when I change this to strQuery = "\"Auditor General\"" I get no > > hits,,, and am confused. Anyone have any thoughts? > > > > Thanks, > > > > Spencer > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -------------------------- > Grant Ingersoll > http://lucene.grantingersoll.com > > Lucene Helpful Hints: > http://wiki.apache.org/lucene-java/BasicsOfPerformance > http://wiki.apache.org/lucene-java/LuceneFAQ > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]