lucene-java-user mailing list archives

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

Yikes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

i.e.  http://www.google.com/search?q=lucene+wildcard+in+phrase

This post seems close to a solution to that problem:
http://mail-archives.apache.org/mod_mbox/lucene-java-user/200607.mbox/%3CB50FE8BF4F9CF24FB800E28DBB1A2FE026D681@gaia.2at.local%3E


Cheers,
Mark


----- Original Message ----
From: Shai Erera <serera@gmail.com>
To: java-user@lucene.apache.org
Sent: Thursday, 22 November, 2007 3:54:51 PM
Subject: Re: help required urgent!!!!!!!!!!!

Hi

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>'.
 Therefore
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,
 Index.UN_TOKENIZED
));

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

Does that help?

On Nov 22, 2007 5:46 PM, Shakti_Sareen <Shakti_Sareen@satyam.com>
 wrote:

> 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
 in
> the word, then we should include that word in the double quotes (").
 But
> enclosing the word in a double quotes (") means the exact word
 search.
>
> How can I perform the like search on a word containing hyphen???????
>
> Please help.
>
> Regards,
> Shakti Sareen
>
>
>
>
>
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use
 of the
> intended recipient/s and may contain material that is CONFIDENTIAL
 AND
> 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
 contact
> the sender by email and delete all copies; your cooperation in this
 regard
> is appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Regards,

Shai Erera





      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message