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 Stray Toaster <mw...@stray-toaster.co.uk> on 2002/10/23 18:09:42 UTC

definite matching

Hi all.

Sorry about this, but this may seem like a silly question. (I have read
the FAQs, the mailing list archive, and I am just _not quite_ sure!)

Firstly, an admission. I am not a good java coder, and am happier in
perl. So I actually use a perl module (Inline::Java) to give me all the
lucene goodness from an enviorment I am comfortable with. And it works a
treat!

Now, the question.

I have a set of documents, all indexed using the SimpleAnalyser. Fine
and dandy.

Now, when I search, I want results back that definitely contain the
search string. Definitely, definitely. Serious consequences for me if
they don't.

Am I right in that just adding a + to the start of the query string does
this? I think it does, I guess I just want reassurance!

Thanks for your time,

m.
-- 
What the hammer? what the chain?
In what furnace was thy brain?
What the anvil? what dread grasp
Dare its deadly terrors clasp?

--
Family ties : http://www.thefamilykerr.co.uk
Playtime    : http://www.stray-toaster.co.uk

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


Re: definite matching

Posted by Stray Toaster <mw...@stray-toaster.co.uk>.
On Wed, Oct 23, 2002 at 09:52:01AM -0700, Peter Carlson wrote:

<snip useful info>

Thanks Peter and Otis! I appreciate it.

m.

-- 
Syntactic sugar causes cancer of the semicolon.

--
Family ties : http://www.thefamilykerr.co.uk
Playtime    : http://www.stray-toaster.co.uk

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


Re: definite matching

Posted by Otis Gospodnetic <ot...@yahoo.com>.
That assumes that you are using the QueryParser, of course...

--- Stray Toaster <mw...@stray-toaster.co.uk> wrote:
> Hi all.
> 
> Sorry about this, but this may seem like a silly question. (I have
> read
> the FAQs, the mailing list archive, and I am just _not quite_ sure!)
> 
> Firstly, an admission. I am not a good java coder, and am happier in
> perl. So I actually use a perl module (Inline::Java) to give me all
> the
> lucene goodness from an enviorment I am comfortable with. And it
> works a
> treat!
> 
> Now, the question.
> 
> I have a set of documents, all indexed using the SimpleAnalyser. Fine
> and dandy.
> 
> Now, when I search, I want results back that definitely contain the
> search string. Definitely, definitely. Serious consequences for me if
> they don't.
> 
> Am I right in that just adding a + to the start of the query string
> does
> this? I think it does, I guess I just want reassurance!
> 
> Thanks for your time,
> 
> m.
> -- 
> What the hammer? what the chain?
> In what furnace was thy brain?
> What the anvil? what dread grasp
> Dare its deadly terrors clasp?
> 
> --
> Family ties : http://www.thefamilykerr.co.uk
> Playtime    : http://www.stray-toaster.co.uk
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

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


Re: definite matching

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Yes :)

--- Stray Toaster <mw...@stray-toaster.co.uk> wrote:
> Hi all.
> 
> Sorry about this, but this may seem like a silly question. (I have
> read
> the FAQs, the mailing list archive, and I am just _not quite_ sure!)
> 
> Firstly, an admission. I am not a good java coder, and am happier in
> perl. So I actually use a perl module (Inline::Java) to give me all
> the
> lucene goodness from an enviorment I am comfortable with. And it
> works a
> treat!
> 
> Now, the question.
> 
> I have a set of documents, all indexed using the SimpleAnalyser. Fine
> and dandy.
> 
> Now, when I search, I want results back that definitely contain the
> search string. Definitely, definitely. Serious consequences for me if
> they don't.
> 
> Am I right in that just adding a + to the start of the query string
> does
> this? I think it does, I guess I just want reassurance!
> 
> Thanks for your time,
> 
> m.
> -- 
> What the hammer? what the chain?
> In what furnace was thy brain?
> What the anvil? what dread grasp
> Dare its deadly terrors clasp?
> 
> --
> Family ties : http://www.thefamilykerr.co.uk
> Playtime    : http://www.stray-toaster.co.uk
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

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


Re: definite matching

Posted by Stray Toaster <mw...@stray-toaster.co.uk>.
On Wed, Oct 23, 2002 at 10:41:59AM -0700, Joshua O'Madadhain wrote:
> Mr. Toaster (or can I just call you "Stray"? ;> ):
> 
> Everything Peter (and Otis) said is true.  

<snip Josjua's cool input>

One more thing, honest!

If I have a numeric field, will

+23

match 23 AND 230 AND 2345 etcetc?

Or similarly with alphabetic fields, would

+toast

match toaster, toasty and toasted? (Or even toast?)

I really need this to match exactly.

Thanks again, guys, I am truly grateful.

m.

-- 
My money don't jingle
 --said by me to Jane Doe before I realised it
It is symbolic of our struggle against oppression
Symbolic of his struggle against reality more like

--
Family ties : http://www.thefamilykerr.co.uk
Playtime    : http://www.stray-toaster.co.uk

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


Re: definite matching

Posted by Joshua O'Madadhain <jm...@ics.uci.edu>.
Mr. Toaster (or can I just call you "Stray"? ;> ):

Everything Peter (and Otis) said is true.  

A point of clarification that may forestall future confusion: the "+" and
"-" terms correspond to "required" and "prohibited", respectively, in a
BooleanQuery.  (Calling it a BooleanQuery is a slight misnomer to my way
of thinking, since as Peter implied, the semantics of "-" aren't quite the
same as "NOT", since you can't just search for "NOT foo".)

So to summarize:
* "+": documents *without* this term/phrase are *not* returned
* "-": documents *with* this term/phrase are *not* returned
* default (no flag): documents with this term/phrase get a higher score
  (all other things being equal) than documents which lack it.
* terms/phrases cannot be specified to be both required and prohibited.

Personally I'd stick with "+" and "-" rather than using the Boolean terms,
simply because I seem to recall that there are some constructs involving
Boolean connectives that don't behave quite the way that you might expect.
(Anyone know what happens if you search for "jam OR NOT(toast AND
bread)"?)

Good luck--

Joshua

On Wed, 23 Oct 2002, Peter Carlson wrote:

> Anyway if you want to only find documents with a given term or set of 
> terms put a + in front of EACH term you are searching for
> 
> +hello +world
> 
> You can also use the AND construct if you are using the QueryParser.
> 
> hello AND world
> 
> this gets translated into
> +hello +world
> 
> The other options are to have a minus sign (-) which will returns 
> documents that don't have that term
> 
> +hello -world
> 
> will find all documents with the term hello and not world.
> Note: You cannot use the - option alone.
>
> Also you can use NOT in the same way
> 
> hello NOT world
> 
> results in
> 
> hello -world
> 
> 
> Finally the OR operator (the current default) operator between terms
> 
> hello world
> 
> or equivalently
> 
> hello OR world
> 
> will find all documents with hello or world in the field.



 jmadden@ics.uci.edu...Obscurium Per Obscurius...www.ics.uci.edu/~jmadden
  Joshua O'Madadhain: Information Scientist, Musician, Philosopher-At-Tall
 It's that moment of dawning comprehension that I live for--Bill Watterson
My opinions are too rational and insightful to be those of any organization.





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


Re: definite matching

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

You should read the query syntax to be more confident. It's available 
in the left side of the Lucene website.

Anyway if you want to only find documents with a given term or set of 
terms put a + in front of EACH term you are searching for


+hello +world

You can also use the AND construct if you are using the QueryParser.

hello AND world

this gets translated into
+hello +world

The other options are to have a minus sign (-) which will returns 
documents that don't have that term

+hello -world

will find all documents with the term hello and not world.
Note: You cannot use the - option alone.

Also you can use NOT in the same way

hello NOT world

results in

hello -world


Finally the OR operator (the current default) operator between terms

hello world

or equivalently

hello OR world

will find all documents with hello or world in the field.

I hope this helps.

--Peter


On Wednesday, October 23, 2002, at 09:09 AM, Stray Toaster wrote:

> Hi all.
>
> Sorry about this, but this may seem like a silly question. (I have read
> the FAQs, the mailing list archive, and I am just _not quite_ sure!)
>
> Firstly, an admission. I am not a good java coder, and am happier in
> perl. So I actually use a perl module (Inline::Java) to give me all the
> lucene goodness from an enviorment I am comfortable with. And it works 
> a
> treat!
>
> Now, the question.
>
> I have a set of documents, all indexed using the SimpleAnalyser. Fine
> and dandy.
>
> Now, when I search, I want results back that definitely contain the
> search string. Definitely, definitely. Serious consequences for me if
> they don't.
>
> Am I right in that just adding a + to the start of the query string 
> does
> this? I think it does, I guess I just want reassurance!
>
> Thanks for your time,
>
> m.
> -- 
> What the hammer? what the chain?
> In what furnace was thy brain?
> What the anvil? what dread grasp
> Dare its deadly terrors clasp?
>
> --
> Family ties : http://www.thefamilykerr.co.uk
> Playtime    : http://www.stray-toaster.co.uk
>
> --
> 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>