Re: Limiting QueryParser

2006-11-22 Thread Antony Bowesman
Erik Hatcher wrote: It doesn't seem like you need a "parser" at all for your field-specific search fields. Simply tokenize, using a Lucene Analyzer, the text field and build up a BooleanQuery of all the tokens. That's what I'm currently doing, but I was getting bogged down with trying to s

Re: Limiting QueryParser

2006-11-22 Thread Antony Bowesman
Michael Rusch wrote: Sorry if I'm missing the point here, but what about simply replacing colons with spaces first? Michael. Err, thanks. I've been in too deep at the wrong end :) Wood, trees and visibility spring to mind! Antony --

Re: Limiting QueryParser

2006-11-22 Thread Erick Erickson
replacing colons with spaces first? Michael. > -Original Message- > From: Antony Bowesman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 21, 2006 10:01 PM > To: java-user@lucene.apache.org > Subject: Re: Limiting QueryParser > > Mark Miller wrote: > > if you s

RE: Limiting QueryParser

2006-11-22 Thread Michael Rusch
Sorry if I'm missing the point here, but what about simply replacing colons with spaces first? Michael. > -Original Message- > From: Antony Bowesman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 21, 2006 10:01 PM > To: java-user@lucene.apache.org > Subject: Re:

Re: Limiting QueryParser

2006-11-22 Thread Erik Hatcher
On Nov 21, 2006, at 10:34 PM, Antony Bowesman wrote: On the field specific fields, I want to control the parsing to ensure that the parser will not interpret fields in the user entered string, so in those fields it treats : as : all of the time. However, in the "free form" field, anything

Re: Limiting QueryParser

2006-11-21 Thread Antony Bowesman
Mark Miller wrote: if you scan the query and escape all colons (ie \:) then you should be good (I have not verified). Of course you will not be able to do a field search, but that seems to be what your after. Thanks for that suggestion. However, a standard un-escaped parse gives Input - impo

Re: Limiting QueryParser

2006-11-21 Thread Antony Bowesman
Chris Hostetter wrote: : important:conference agenda : I want to end up with : : +subject:important +subject:conference +subject:agenda : : I've written something to do this, but I know it is not as clever as QP as : currently it can only create BooleanQueries with TermQueries and cannot handle

Re: Limiting QueryParser

2006-11-21 Thread Mark Miller
Keep in mind that this would not work for important:"conference agenda" as the quotes would be escaped and queryparser will not generate a phrase query - Mark Steven Rowe wrote: static String QueryParser.escape(String) should do the trick:

Limiting QueryParser

2006-11-21 Thread Antony Bowesman
Hi, I have a search UI that allows search criteria to be input against specific fields, e.g. Subject. In order to create a suitable Lucene Query, I must analyze that String so that it becomes a set of Tokens which I can then turn into Terms. QueryParser seems to fit the bill for that, howev

Re: Limiting QueryParser

2006-11-21 Thread Chris Hostetter
: important:conference agenda : I want to end up with : : +subject:important +subject:conference +subject:agenda : : I've written something to do this, but I know it is not as clever as QP as : currently it can only create BooleanQueries with TermQueries and cannot handle : PhraseQuery, so would

Re: Limiting QueryParser

2006-11-21 Thread Steven Rowe
static String QueryParser.escape(String) should do the trick: Look at the bottom of the below-linked page for the list of characters that the above method will escape: