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 Paul Taylor <pa...@fastmail.fm> on 2010/03/19 12:31:48 UTC

Version.onOrAfter() complaing its Deprecated but it isnt

Hi since downloading Lucene 3.1 my code complains that 
Version.onOrAfter() complaing its deprecated but i also have svn access 
to the source and it isn't deprecated , and doesnt look like it ever has 
been, anyone else get this ?

Paul

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


Re: Prefix And Fuzzy

Posted by Anshum <an...@gmail.com>.
Hi Veera,
I'd say you should get yourself a copy of Lucene In Action 2 Ed. It would
really help you figure out the hows and why's in case you are looking at
using lucene further.
Talking about your solution, let me explain it to you a bit. When
you analyse a particular field in lucene, it gets tokenized/processed prior
to getting indexed. The way the processing would happen depends on your
analyzer (which here is StopAnalyzer). So point 1. If you analyze a field
with value *'My name is anshum' *it would get broken down into tokens, e.g.
[my] [name] [is] [anshum] where each term in the [] is a token
indexed separately.
A search on my or a search on name or a search on anshum would get you this
document. Whereas in case you don't analyze it, the field would get indexed
as it is and this document would only be picked up if its an exact match for
the complete value i.e. the document would have one token with the value *[my
name is anshum].*
**Hope you get what 'm trying to put forward here.
Reanalyze your requirement, you might really want to analyze the field. Do
not avoid analysis of the field only to get a particular test case work
fine, it might trouble you later!
Analyze your field using a suitable analyzer and the searches should just
work fine.

--
Anshum Gupta
http://anshumgupta.net

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Fri, Mar 19, 2010 at 9:06 PM, vhanuman kumarbaburavi <
V.Ravi@niit-tech.com> wrote:

> Dear Paul,
>
>
>
> Still I am fighting with Prefix and Fuzzy search. Based on archive post I
> have noticed once thing i.e. when the prefix search will work only for
> "Field.Index.NOT_ANALYZED" type. I have changed that one prefix working
> perfectly. But the fuzzy search is working stopped, I hope because of the
> Index type when I changed to "Field.Index.ANALYZED" it starts working. I am
> using "lucene 3.0"version.
>
>
>
> I have implemented these two searches in my application following way.
>
>
>
> IndexSearcher is = new IndexSearcher(FSDirectory.open(new
> File("index11")));
>
> is.setSimilarity(Similarity.getDefault());
>
> Analyzer analyzer = new StopAnalyzer(Version.LUCENE_30);
>
> QueryParser parser = new QueryParser(Version.LUCENE_30, "name",analyzer);
>
> parser.setLowercaseExpandedTerms(true);
>
> parser.setEnablePositionIncrements(true);
>
> parser.setAllowLeadingWildcard(true);
>
> parser.setFuzzyPrefixLength(4);
>
> parser.setFuzzyMinSim(0.8f);
>
>
>
> BooleanQuery booleanQuery = new BooleanQuery(true);
>
> parser.setAllowLeadingWildcard(true);
>
> booleanQuery.add(parser.parse("Tick*"), BooleanClause.Occur.SHOULD);
>
> booleanQuery.add(parser.parse("Tick~"), BooleanClause.Occur.SHOULD);
>
>
>
> ScoreDoc[] hits = is.search(booleanQuery, 1000).scoreDocs;
>
> for (int i = 0; i < hits.length; i++) {
>
>      Document hitDoc = is.doc(hits[i].doc);
>
>      System.out.println(hitDoc.get("name") + "\t" + i);
>
> }
>
>
>
> Please suggest me ASAP.
>
>
>
> Thanks & Regards
>
>
>
> Veera.
>
>
>
>
>
> -----Original Message-----
> From: Paul Taylor [mailto:paul_t100@fastmail.fm]
> Sent: Friday, March 19, 2010 5:02 PM
> To: java-user@lucene.apache.org
> Subject: Version.onOrAfter() complaing its Deprecated but it isnt
>
>
>
> Hi since downloading Lucene 3.1 my code complains that
>
> Version.onOrAfter() complaing its deprecated but i also have svn access
>
> to the source and it isn't deprecated , and doesnt look like it ever has
>
> been, anyone else get this ?
>
>
>
> Paul
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
> ________________________________
> DISCLAIMER
>
> The content of this email and any attachments ('email') is confidential,
> may be privileged, subject to copyright and may be read and used only by the
> intended recipient. If you are not the intended recipient please notify us
> by return email or telephone and erase all copies and do not disclose the
> email or any part of it to any person. Email transmission cannot be
> guaranteed to be secure, or error free as information could be intercepted,
> corrupted, lost or destroyed as a result of the transmission process. The
> sender, therefore, does not accept liability for any errors, omissions,
> viruses or delay in transmission as a result of this mail. We monitor email
> communications through our networks for regulatory compliance purposes and
> to protect our clients, employees and business. Opinions, conclusions, and
> other information in this message that do not relate to the official
> business of NIIT Technologies Ltd. or its affiliate(s) shall be understood
> to be neither given nor endorsed by NIIT Technologies Ltd. or its
> affiliate(s).
>

Prefix And Fuzzy

Posted by vhanuman kumarbaburavi <V....@NIIT-Tech.com>.
Dear Paul,



Still I am fighting with Prefix and Fuzzy search. Based on archive post I have noticed once thing i.e. when the prefix search will work only for "Field.Index.NOT_ANALYZED" type. I have changed that one prefix working perfectly. But the fuzzy search is working stopped, I hope because of the Index type when I changed to "Field.Index.ANALYZED" it starts working. I am using "lucene 3.0"version.



I have implemented these two searches in my application following way.



IndexSearcher is = new IndexSearcher(FSDirectory.open(new File("index11")));

is.setSimilarity(Similarity.getDefault());

Analyzer analyzer = new StopAnalyzer(Version.LUCENE_30);

QueryParser parser = new QueryParser(Version.LUCENE_30, "name",analyzer);

parser.setLowercaseExpandedTerms(true);

parser.setEnablePositionIncrements(true);

parser.setAllowLeadingWildcard(true);

parser.setFuzzyPrefixLength(4);

parser.setFuzzyMinSim(0.8f);



BooleanQuery booleanQuery = new BooleanQuery(true);

parser.setAllowLeadingWildcard(true);

booleanQuery.add(parser.parse("Tick*"), BooleanClause.Occur.SHOULD);

booleanQuery.add(parser.parse("Tick~"), BooleanClause.Occur.SHOULD);



ScoreDoc[] hits = is.search(booleanQuery, 1000).scoreDocs;

for (int i = 0; i < hits.length; i++) {

      Document hitDoc = is.doc(hits[i].doc);

      System.out.println(hitDoc.get("name") + "\t" + i);

}



Please suggest me ASAP.



Thanks & Regards



Veera.





-----Original Message-----
From: Paul Taylor [mailto:paul_t100@fastmail.fm]
Sent: Friday, March 19, 2010 5:02 PM
To: java-user@lucene.apache.org
Subject: Version.onOrAfter() complaing its Deprecated but it isnt



Hi since downloading Lucene 3.1 my code complains that

Version.onOrAfter() complaing its deprecated but i also have svn access

to the source and it isn't deprecated , and doesnt look like it ever has

been, anyone else get this ?



Paul



---------------------------------------------------------------------

To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org

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



________________________________
DISCLAIMER

The content of this email and any attachments ('email') is confidential, may be privileged, subject to copyright and may be read and used only by the intended recipient. If you are not the intended recipient please notify us by return email or telephone and erase all copies and do not disclose the email or any part of it to any person. Email transmission cannot be guaranteed to be secure, or error free as information could be intercepted, corrupted, lost or destroyed as a result of the transmission process. The sender, therefore, does not accept liability for any errors, omissions, viruses or delay in transmission as a result of this mail. We monitor email communications through our networks for regulatory compliance purposes and to protect our clients, employees and business. Opinions, conclusions, and other information in this message that do not relate to the official business of NIIT Technologies Ltd. or its affiliate(s) shall be understood to be neither given nor endorsed by NIIT Technologies Ltd. or its affiliate(s).

Re: Version.onOrAfter() complaing its Deprecated but it isnt

Posted by Paul Taylor <pa...@fastmail.fm>.
kumarbabu ravi wrote:
> I would like to say thanks first. But I have a small problem on both prefix
> and Fuzzy search. Is it possible to perform both Prefix and Fuzzy search at
> time. I mean to say using FuzzyPrefixLength and setFuzzyMinSim.
> Please suggest me ASAP.
>
>   
kumarvarbi, thanks for hijacking my thread :(

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


Re: Version.onOrAfter() complaing its Deprecated but it isnt

Posted by kumarbabu ravi <ku...@gmail.com>.
I would like to say thanks first. But I have a small problem on both prefix
and Fuzzy search. Is it possible to perform both Prefix and Fuzzy search at
time. I mean to say using FuzzyPrefixLength and setFuzzyMinSim.
Please suggest me ASAP.





On Fri, Mar 19, 2010 at 5:17 PM, Ian Lea <ia...@gmail.com> wrote:

> 1.  Please ask new questions in new threads.
>
> 2.  Read the "Why am I getting no hits / incorrect hits?" section of
> the FAQ.  If that doesn't help post again (in a new thread) showing us
> how you are indexing the search field and creating the query and what
> the toString() method shows.  And use Luke to check that you are
> indexing what you think you are.
>
>
> --
> Ian.
>
>
> On Fri, Mar 19, 2010 at 11:39 AM, vhanuman kumarbaburavi
> <V....@niit-tech.com> wrote:
> >
> > Hi Paul,
> >
> > I need some help on Lucene prefix search. I have implemented prefix
> search in my application but it is return different result like following
> way.
> >
> > E.g. three products see below
> >
> > Abc def zse,
> > def sde sed,
> > fed fer def.
> >
> > I entered the characters like "def" and I performed prefix search, I got
> following results.
> >
> > Abc def zse
> > def sde sed
> > fed fer def.
> >
> > But I want only one result instead of above result i.e. "def sde sed"
> >
> > Please help me.
> >
> >
> > Thanks & Regards
> >
> > |Sr.Software Engineer| NIIT Technologies Ltd.
> > Tapasya(Corporate Heights), Plot No. 5, EFGH, Sector 126,
> >
> > Greater Noida Express Way, NOIDA(Office: Ex.No 51523 Mb: 9958381449)
> >
> > | Email:- vhanuman.k@nii-tech.com|www.niit-tech.com|
> >
> >
> > -----Original Message-----
> > From: Paul Taylor [mailto:paul_t100@fastmail.fm]
> > Sent: Friday, March 19, 2010 5:02 PM
> > To: java-user@lucene.apache.org
> > Subject: Version.onOrAfter() complaing its Deprecated but it isnt
> >
> > Hi since downloading Lucene 3.1 my code complains that
> > Version.onOrAfter() complaing its deprecated but i also have svn access
> > to the source and it isn't deprecated , and doesnt look like it ever has
> > been, anyone else get this ?
> >
> > Paul
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
> > DISCLAIMER
> >
> > The content of this email and any attachments ('email') is confidential,
> may be privileged, subject to copyright and may be read and used only by the
> intended recipient. If you are not the intended recipient please notify us
> by return email or telephone and erase all copies and do not disclose the
> email or any part of it to any person. Email transmission cannot be
> guaranteed to be secure, or error free as information could be intercepted,
> corrupted, lost or destroyed as a result of the transmission process. The
> sender, therefore, does not accept liability for any errors, omissions,
> viruses or delay in transmission as a result of this mail.  We monitor email
> communications through our networks for regulatory compliance purposes and
> to protect our clients, employees and business. Opinions, conclusions, and
> other information in this message that do not relate to the official
> business of NIIT Technologies Ltd. or its affiliate(s) shall be understood
> to be neither given nor endorsed by NIIT Technologies Ltd. or its
> affiliate(s).
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 








Thanks
--kumarbabu
Discouragement and failure are two of the surest stepping stones to success.
----- Dale Carnegie

Re: Version.onOrAfter() complaing its Deprecated but it isnt

Posted by Ian Lea <ia...@gmail.com>.
1.  Please ask new questions in new threads.

2.  Read the "Why am I getting no hits / incorrect hits?" section of
the FAQ.  If that doesn't help post again (in a new thread) showing us
how you are indexing the search field and creating the query and what
the toString() method shows.  And use Luke to check that you are
indexing what you think you are.


--
Ian.


On Fri, Mar 19, 2010 at 11:39 AM, vhanuman kumarbaburavi
<V....@niit-tech.com> wrote:
>
> Hi Paul,
>
> I need some help on Lucene prefix search. I have implemented prefix search in my application but it is return different result like following way.
>
> E.g. three products see below
>
> Abc def zse,
> def sde sed,
> fed fer def.
>
> I entered the characters like "def" and I performed prefix search, I got following results.
>
> Abc def zse
> def sde sed
> fed fer def.
>
> But I want only one result instead of above result i.e. "def sde sed"
>
> Please help me.
>
>
> Thanks & Regards
>
> |Sr.Software Engineer| NIIT Technologies Ltd.
> Tapasya(Corporate Heights), Plot No. 5, EFGH, Sector 126,
>
> Greater Noida Express Way, NOIDA(Office: Ex.No 51523 Mb: 9958381449)
>
> | Email:- vhanuman.k@nii-tech.com|www.niit-tech.com|
>
>
> -----Original Message-----
> From: Paul Taylor [mailto:paul_t100@fastmail.fm]
> Sent: Friday, March 19, 2010 5:02 PM
> To: java-user@lucene.apache.org
> Subject: Version.onOrAfter() complaing its Deprecated but it isnt
>
> Hi since downloading Lucene 3.1 my code complains that
> Version.onOrAfter() complaing its deprecated but i also have svn access
> to the source and it isn't deprecated , and doesnt look like it ever has
> been, anyone else get this ?
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
> DISCLAIMER
>
> The content of this email and any attachments ('email') is confidential, may be privileged, subject to copyright and may be read and used only by the intended recipient. If you are not the intended recipient please notify us by return email or telephone and erase all copies and do not disclose the email or any part of it to any person. Email transmission cannot be guaranteed to be secure, or error free as information could be intercepted, corrupted, lost or destroyed as a result of the transmission process. The sender, therefore, does not accept liability for any errors, omissions, viruses or delay in transmission as a result of this mail.  We monitor email communications through our networks for regulatory compliance purposes and to protect our clients, employees and business. Opinions, conclusions, and other information in this message that do not relate to the official business of NIIT Technologies Ltd. or its affiliate(s) shall be understood to be neither given nor endorsed by NIIT Technologies Ltd. or its affiliate(s).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


RE: Version.onOrAfter() complaing its Deprecated but it isnt

Posted by vhanuman kumarbaburavi <V....@NIIT-Tech.com>.
Hi Paul,

I need some help on Lucene prefix search. I have implemented prefix search in my application but it is return different result like following way.

E.g. three products see below

Abc def zse,
def sde sed,
fed fer def.

I entered the characters like "def" and I performed prefix search, I got following results.

Abc def zse
def sde sed
fed fer def.

But I want only one result instead of above result i.e. "def sde sed"

Please help me.


Thanks & Regards

|Sr.Software Engineer| NIIT Technologies Ltd.
Tapasya(Corporate Heights), Plot No. 5, EFGH, Sector 126,

Greater Noida Express Way, NOIDA(Office: Ex.No 51523 Mb: 9958381449)

| Email:- vhanuman.k@nii-tech.com|www.niit-tech.com|


-----Original Message-----
From: Paul Taylor [mailto:paul_t100@fastmail.fm]
Sent: Friday, March 19, 2010 5:02 PM
To: java-user@lucene.apache.org
Subject: Version.onOrAfter() complaing its Deprecated but it isnt

Hi since downloading Lucene 3.1 my code complains that
Version.onOrAfter() complaing its deprecated but i also have svn access
to the source and it isn't deprecated , and doesnt look like it ever has
been, anyone else get this ?

Paul

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


DISCLAIMER

The content of this email and any attachments ('email') is confidential, may be privileged, subject to copyright and may be read and used only by the intended recipient. If you are not the intended recipient please notify us by return email or telephone and erase all copies and do not disclose the email or any part of it to any person. Email transmission cannot be guaranteed to be secure, or error free as information could be intercepted, corrupted, lost or destroyed as a result of the transmission process. The sender, therefore, does not accept liability for any errors, omissions, viruses or delay in transmission as a result of this mail.  We monitor email communications through our networks for regulatory compliance purposes and to protect our clients, employees and business. Opinions, conclusions, and other information in this message that do not relate to the official business of NIIT Technologies Ltd. or its affiliate(s) shall be understood to be neither given nor endorsed by NIIT Technologies Ltd. or its affiliate(s).

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