You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Howk, Michael" <MH...@FSC.Follett.com> on 2002/02/22 22:52:29 UTC

Using the question mark to search a single character

We've finally bit the bullet and jumped from RC2 to the nightly build. Now,
when we do a search that contains a question mark, it seems to replace the
question mark with a space. We're using the StandardAnalyzer, and we've
tried to find "mary had a little lamb" by using "ma?y", "littl?", and
"litt?e". None of these searches return the record. What do we need to
change in order to allow the question mark to work again?

Michael

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Googlifying lucene querys

Posted by Peter Carlson <ca...@bookandhammer.com>.
Hi Jari,

Lucene is designed as an API with different components broken out so a
developer can create the uniqueness required.

One part of Lucene is the QueryParser. The QueryParser takes a search string
and create a set of classes based on the current QueryParser.jj
implementation and turns it into a Lucene Query. This is meant to be a good
solution for most people, but it is just a sample of what can be done.

In the current implementation of QueryParser

'george bush "white house"'
Will create an OR query of
George OR bush OR "white house"
Basically, the default is an OR between words unless otherwise specified.

You can use other boolean operators like AND, and NOT
So 
'george AND bush OR "white house" NOT ford'

Lucene and the current QueryParser supports
wildcards with the * character
Single character replace with the ? Character
Fuzzy searches with the ~ character when next to a single word term
Proximity searches (just added to QueryParser) with the ~3 next to a phrase
term

Again, you can create your own QueryParser to create your desired
implementation.

I hope this helps.

--Peter




On 2/23/02 8:19 AM, "Jari Aarniala" <fo...@welho.com> wrote:

>> +george +bush +white +house
> 
> Well, that's pretty obvious even for me :) If you have separate words,
> just tokenize the string and add a plus in front of each of the words.
> But what I'm trying to do here is this:
> 
> Let's say I have a more complicated query, say
> 
> 'george bush "white house"'
> 
> There you have two separate words, "george" and "bush" and then
> "white house" enclosed in quotes. If I use a piece of simple
> tokenization code, the above query becomes
> 
> +georbe +bush +"white +house"
> 
> See what I mean? That won't work the way expected.
> Anyway, I'm still a bit confused the inner workings of Lucene,
> so maybe I'll come up with something myself.
> 
> Jari Aarniala
> foo@welho.com 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Googlifying lucene querys

Posted by Jari Aarniala <fo...@welho.com>.
> +george +bush +white +house

Well, that's pretty obvious even for me :) If you have separate words,
just tokenize the string and add a plus in front of each of the words.
But what I'm trying to do here is this:

	Let's say I have a more complicated query, say

	'george bush "white house"'

	There you have two separate words, "george" and "bush" and then
"white house" enclosed in quotes. If I use a piece of simple
tokenization code, the above query becomes

	+georbe +bush +"white +house"

See what I mean? That won't work the way expected.
	Anyway, I'm still a bit confused the inner workings of Lucene,
so maybe I'll come up with something myself.

	Jari Aarniala
	foo@welho.com 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Googlifying lucene querys

Posted by Ian Lea <ia...@blackwell.co.uk>.
+george +bush +white +house


--
Ian.

Jari Aarniala wrote:
> 
> Hello,
> 
> Despite of the confusing subject ;) my question is simple. I'm just
> trying out Lucene for the first time and would like to know how one
> would go on implementing the search on the index with the same logic
> that Google uses.
>         For example, if the user input is "george bush white house", how
> do I easily construct a query that searches ALL of the words above? If I
> have understood correctly, passing the search string above to the
> queryParser creates a query that search for ANY of the words above.
> 
>         Thanks for any help,

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Googlifying lucene querys

Posted by Jari Aarniala <fo...@welho.com>.
Hello,

Despite of the confusing subject ;) my question is simple. I'm just
trying out Lucene for the first time and would like to know how one
would go on implementing the search on the index with the same logic
that Google uses.
	For example, if the user input is "george bush white house", how
do I easily construct a query that searches ALL of the words above? If I
have understood correctly, passing the search string above to the
queryParser creates a query that search for ANY of the words above.

	Thanks for any help,

	Jari Aarniala
	foo@welho.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>