lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agrawal, Aashish \(IT\)" <Aashish.Agra...@morganstanley.com>
Subject RE: example on RegexQuery
Date Mon, 27 Oct 2008 03:36:39 GMT
Hi Steven

thanks for pointing to the example of RegexQuery. 

I have a simple code snippet which is not working, not sure if I am
using it incorrectly. 
----
      RegexQuery query = new RegexQuery (new Term (field, line)); 
      query.setRegexImplementation(new JavaUtilRegexCapabilities());
      System.out.println("Searching for: " + query.toString(field));
      Hits hits = searcher.search(query); 
--------

I am searching a sample file like below - 
---
agrawal fdfdf
fsdfafasf 3495549584
fsfsfs fsffsf r4e3fdere j4343  
---------

when I search this file with pattern - 
.*4343*
.*[a-z]4343
j4343
or even search for   3495549584

all are failing with result no match found..

could you point me what is wrong here ?? Also if I try to search *4343*,
it throws exception,, shouldn't * at start be  allowed with regexQuery ?


thanks
Aashish Agrawal

-----Original Message-----
From: Steven A Rowe [mailto:sarowe@syr.edu] 
Sent: Saturday, October 25, 2008 12:31 AM
To: java-user@lucene.apache.org
Subject: RE: example on RegexQuery 

Hi Aashish,

On 10/24/2008 at 3:35 AM, Agrawal, Aashish (IT) wrote:
> I want to use lucene for a simple search engine  with regex support .
> I tried using RegexQuery.. but seems I am missing something.
> Is there any working exmaple on using RegexQuery ??

How about TestRegexQuery?:

<http://svn.apache.org/viewvc/lucene/java/tags/lucene_2_4_0/contrib/rege
x/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?view=marku
p>

Steve

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

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in error.

---------------------------------------------------------------------
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