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: <mailto:lucene-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@;jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@;jakarta.apache.org>

Reply via email to