MultiPhrase search

2008-08-25 Thread Andre Rubin
Hi all, Let's say that I have in my index the value "One Two Three" for field 'A'. I'm using a custom analyzer that is described in the forwarded message. My Search query is built like this: QueryParser parser = new QueryParser(LABEL_FIELD, ANALYZER); Query query = parser.parse(LABEL_FIE

Re: MultiPhrase search

2008-08-25 Thread Daniel Naber
On Montag, 25. August 2008, Andre Rubin wrote: > I tried it out but with no luck (I think I did it wrong). In any > case, is MultiPhraseQuery what I'm looking for? If it is, how should I > use the MultiPhraseQuery class? No, you won't need it. If you know that the field is not really tokenized

Re: MultiPhrase search

2008-08-25 Thread Andre Rubin
For some reason, the TermQuery is not returning any results, even when querying for a single word (like on*). query = new TermQuery(new Term(LABEL_FIELD, searchString)); On 8/25/08, Daniel Naber <[EMAIL PROTECTED]> wrote: > On Montag, 25. August 2008, Andre Rubin wrote: > >> I tried it out but w

Re: MultiPhrase search

2008-08-26 Thread Daniel Naber
On Dienstag, 26. August 2008, Andre Rubin wrote: > For some reason, the TermQuery is not returning any results, even when > querying for a single word (like on*). Sorry, I meant PrefixQuery. Also, do not add the "*" to the search string when creating the PrefixQuery. Regards Daniel -- http:/

Re: MultiPhrase search

2008-08-26 Thread Andre Rubin
That worked great! Thanks Daniel. I just have one more use case. I want the same prefix search as before, plus another match in another field. I was using MultiFieldQueryParser.parse(), but then I have the same problem with the "One Tw*" query, cause MultiFieldQueryParser.parse() returns a Boolea

Re: MultiPhrase search

2008-08-26 Thread Daniel Naber
On Dienstag, 26. August 2008, Andre Rubin wrote: > I just have one more use case. I want the same prefix search as before, > plus another match in another field. Not sure if I'm following you, but you can create your own BooleanQuery programmatically, and then add the original PrefixQuery and an

Re: MultiPhrase search

2008-08-26 Thread Andre Rubin
Now I was the one who didn't follow: How do I add a query to an existing query? Let me be more clear on my use case: I have two documents: 1) label:One Two Three type:sequence 2) label:One Two FOUR type:other I want to be able to make the same kind of search as you described earlier using Pref

Re: MultiPhrase search

2008-08-26 Thread Daniel Naber
On Dienstag, 26. August 2008, Andre Rubin wrote: > Now I was the one who didn't follow: How do I add a query to an existing > query? Something like this should work: BooleanQuery bq = new BooleanQuery(); PrefixQuery pq = new PrefixQuery(...); bq.add(pq, BooleanClause.Occur.MUST); TermQuery tq =

Re: MultiPhrase search

2008-08-26 Thread Andre Rubin
Thanks again Daniel, It's working now. But for some reason, TermQuery is not working for me (i think because I have special characters in the query). I replaced the TermQuery with the query below and I got the results I was expecting. Thanks String escapedType = QueryParser.escape(type); Que