Re: Keyword search with space and wildcard

2003-09-03 Thread Brian Campbell
Unfortunately for me, I have done a good bit of yacc in the past.  Don't 
really wanna have to look in the class unless is absolutely necessary!   :-)

Well, like Eric mentioned, if you can just ignore JavaCC syntax and look
at embedded Java code, it's not all that complicated (especially you have
done something with yacc/bison, to know how parser generators generally
work)... but granted at first looks bit alien. :-)


I did a couple of basic tests using the WildcardQuery like below and it 
seemed to work.  I have not tried an example using the PrefixQuery and I 
doubt that I will.


Now, I haven't tested this, but I would think that just building single 
Query
that searches wild card phrase "some th*" in field "my_field", you'd just 
do:

Query q = new WildcardQuery(new Term("my_field", "some th*"));

and feed that to whichever search object you need. In this particular case 
you
could also use PrefixQuery instead; if so, you need strip out the trailing
"*" (since that's implied when constructing PrefixQuery).



Because of the nature of my application I'm guaranteed to have at least one 
search term but the majority of the time it will be more then one.  So in my 
particular case, I'll almost always get a BooleanQuery back from 
QueryParser.  I'm currently working on an implementation of Eric's 
suggestion.


Eric described the method of combining queries that should work as far as I
could see. If you do not want to rely on QueryParer to return BooleanQuery,
you can also just build your your BooleanQuery, and wrap sub-queries as
BooleanClauses. That's bit more work but should work as well.
Thanks to everyone for the help.  It is much appreciated.

-Brian

_
MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Keyword search with space and wildcard

2003-09-02 Thread Brian Campbell
Great.  Is there an example anywhere on how I might be able to build such a 
Query?  QueryParser isn't really all that simple since it's built with 
JavaCC.

What might be ideal for me is if I can continue to use the highlevel 
interface to build the main query (ie use it to parse my query string and 
return me some kind of Query - BooleanQuery, TermQuery, etc) and then build 
a WildcardQuery by hand and "combine" the two together?  For example, is it 
as simple as calling Query.combine() to combine the two?  Is there a better 
way?  Is there a documented example like this?  Thanks!

-Brian




This can be done, AFAIK.

This is one thing that many people seem unaware of: you don't HAVE to use
QueryParser to build queries. In your case it seems like you should be able
to construct query you want if you either by-pass QueryParser, or create
a dummy analyzer (one that does no tokenization but returns all input as
one token).
_
Enter for your chance to IM with Bon Jovi, Seal, Bow Wow, or Mary J Blige 
using MSN Messenger http://entertainment.msn.com/imastar

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Keyword search with space and wildcard

2003-08-29 Thread Brian Campbell
Basically, yes, I am trying to put a wildcard in a phrase.  My field (a 
Keyword) is the name of a project.  It can be 40 characters long (I'm 
basically indexing some database columns).  Since it is a Keyword and not a 
Text field, it doesn't get tokenized (I do this on purpose) and must match 
up exactly.  I would like for users to be able to search on partial phrases 
such as "Hello w*" and match up to "Hello world" and "Hello washington", 
etc.  Is this not possible?  Is it documented anywhere?

Thanks.
-Brian



From: "Terry Steichen" <[EMAIL PROTECTED]>
Reply-To: "Lucene Users List" <[EMAIL PROTECTED]>
To: "Lucene Users List" <[EMAIL PROTECTED]>
Subject: Re: Keyword search with space and wildcard
Date: Thu, 28 Aug 2003 22:29:44 -0400
If I understand your issue correctly, I think what you're experiencing is
the fact that you can have a phrase query "hello world", or a wildcard 
query
+hell* +wor*, but you can't mix the two together.  As far as I've found,
that's a basic limitation you just have to live with.  (Of course, if
someone on the list can show me where I'm wrong, I'll be delighted.)  You
can add boosting to any kind of term (such as wor*^10 or "world order"^10),
but (I don't think) you can't mix wildcards and phrases.

HTH,

Terry

- Original Message -
From: "Brian Campbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 28, 2003 4:45 PM
Subject: Keyword search with space and wildcard
> I've created and index that has a Keyword field in it.  I'm trying to do 
a
> search on that field where my term has a space and the wildcard 
character
in
> it.  For example, I'll issue the following search:  project_name:"Hello
w*".
>   I have an entry in the project_name field of "Hello world".  I would
> expect to get a hit on this but I don't.  Is this not the way Lucene
> behaves? Am I doing something wrong?  Thanks.
>
> -Brian
>
> _
> Help protect your PC: Get a free online virus scan at McAfee.com.
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
> -
> 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]
_
Get MSN 8 and help protect your children with advanced parental controls.  
http://join.msn.com/?page=features/parental

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Keyword search with space and wildcard

2003-08-28 Thread Brian Campbell
I've created and index that has a Keyword field in it.  I'm trying to do a 
search on that field where my term has a space and the wildcard character in 
it.  For example, I'll issue the following search:  project_name:"Hello w*". 
 I have an entry in the project_name field of "Hello world".  I would 
expect to get a hit on this but I don't.  Is this not the way Lucene 
behaves? Am I doing something wrong?  Thanks.

-Brian

_
Help protect your PC: Get a free online virus scan at McAfee.com. 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]