lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <>
Subject Re: help required urgent!!!!!!!!!!!
Date Thu, 22 Nov 2007 16:19:32 GMT
>>Re: help required urgent!!!!!!!!!!!


I'm guessing that the question was more about how to support this in the standard query syntax
where there are multiple words.


This post seems close to a solution to that problem:


----- Original Message ----
From: Shai Erera <>
Sent: Thursday, 22 November, 2007 3:54:51 PM
Subject: Re: help required urgent!!!!!!!!!!!


You can simply create a PrefixQuery. However, if you're using
StandardAnalyzer, and the word is added as Index.TOKENIZED,
sotf-wa<something> will be broken to 'soft' and 'wa<something>'.
you'll need to add the word as Index.UN_TOKENIZED, or use a different
Analyzer when you index the data (for this field at least).

Here's a sample code:

        // Indexing.
        Document doc = new Document();
        doc.add(new Field("field", "soft-wash", Store.NO,

        // Search
        Query q = new PrefixQuery(new Term("field", "soft-wa"));

Does that help?

On Nov 22, 2007 5:46 PM, Shakti_Sareen <>

> Hi
> I am using StandardAnalyser() to index the data.
> But I want to do a like search on a word containing Hyphen
> For example it want to search a word "soft-wa*"
> I am getting no hits for that. It is said that if the hyphen is there
> the word, then we should include that word in the double quotes (").
> enclosing the word in a double quotes (") means the exact word
> How can I perform the like search on a word containing hyphen???????
> Please help.
> Regards,
> Shakti Sareen
> This email (including any attachments) is intended for the sole use
 of the
> intended recipient/s and may contain material that is CONFIDENTIAL
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or
 copying or
> distribution or forwarding of any or all of the contents in this
 message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please
> the sender by email and delete all copies; your cooperation in this
> is appreciated.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:


Shai Erera

Want ideas for reducing your carbon footprint? Visit Yahoo! For Good

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message