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 tirupathi reddy <ti...@yahoo.com> on 2005/09/19 10:41:14 UTC
Some problem with prefix wilcard search
Hello,
I am using Lucene for for searching in my application.
My application needs prefix wildcard search also.
But Lucene doesn't support this. So I changed in the QueryParser.jj file
FROM:
| <WILDTERM: <_TERM_START_CHAR>
(<_TERM_CHAR> | ( [ "*", "?" ] ))* >
To:
| <WILDTERM: (<_TERM_CHAR> | ( [ "*", "?" ] ))* >
And then I build it using ant and then by using
command ant -Djavacc.home = C:/javac javacc
And both times it was saying build was successful.
Then I put in the classpath, the newly generated jar file in build directory
instead of lucene-current.jar. Even then it is not working for
prefix wildcard search (e.g. *patent). And I am getting the following error:
caught a class org.apache.lucene.queryParser.ParseException
with message: Lexical error at line 1, column 2. Encountered:
"*" (42), after : ""
Is it the correct way for to make it work for prefix wildcard
search using lucene.
Is there any thing wrong I am doing?
Is there any other way to do this?
part of my querying code is:
Query query = QueryParser.parse(query,"ALL",analyzer);
Hits hits = searcher.search(query);
And the query I am passing e.g. is *static.
So please any one help me to solve this problem.
Tirupati Reddy Manyam
24-06-08,
Sundugaullee-24,
79110 Freiburg
GERMANY.
Phone: 00497618811257
cell : 004917624649007
---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
Re: Some problem with prefix wilcard search
Posted by Daniel Naber <lu...@danielnaber.de>.
On Monday 19 September 2005 18:24, Erik Hatcher wrote:
> So what's the deal with this? It looks like something is wrong with
> your environment if it cannot resolve java.io.Reader.
There once was a problem that the import statement for this was missing in
the .jj file and thus it's missing in the .java file. Just add it manually
and recompile.
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Some problem with prefix wilcard search
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Sep 19, 2005, at 11:03 AM, tirupathi reddy wrote:
> C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3>ant -Djavacc.home=c:/javacc
> javacc
> Buildfile: build.xml
> init:
> javacc-check:
> javacc-StandardAnalyzer:
> invoke-javacc:
> [java] Java Compiler Compiler Version 3.2 (Parser Generator)
> [java] (type "javacc" with no arguments for help)
> [java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3
> \src\java\org
> \apache\lucene\analysis\standard\StandardTokenizer.jj . . .
> [java] Note: UNICODE_INPUT option is specified. Please make
> sure you create
> the parser/lexer usig a Reader with the correct character encoding.
> [java] Parser generated successfully.
> [copy] Copying 3 files to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3
> \src\java\or
> g\apache\lucene\analysis\standard
> javacc-QueryParser:
> invoke-javacc:
> [java] Java Compiler Compiler Version 3.2 (Parser Generator)
> [java] (type "javacc" with no arguments for help)
> [java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3
> \src\java\org
> \apache\lucene\queryParser\QueryParser.jj . . .
> [java] Warning: Line 608, Column 3: Regular expression for
> WILDTERM can be
> matched by the empty string ("") in lexical state DEFAULT. This can
> result in an
> endless loop of empty string matches.
This warning doesn't look good - though maybe it's harmless in this
case?
> So i run that command after issuing ant command instead of
> ant -Djavacc.home=c:/javacc javacc.
>
> And the build for that was failed.
>
> And the output is:
>
> [javac] Compiling 160 source files to C:\LUCENE-CURRENT\SOURCE
> \lucene-1.4.3\
> build\classes\java
> [javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org
> \apache\lucene\ana
> lysis\standard\StandardTokenizer.java:15: cannot find symbol
> [javac] symbol : class Reader
> [javac] location: class
> org.apache.lucene.analysis.standard.StandardTokenize
> r
> [javac] public StandardTokenizer(Reader reader) {
So what's the deal with this? It looks like something is wrong with
your environment if it cannot resolve java.io.Reader.
What JDK are you building with?
Others - please feel free to jump in and help out. I've not got much
time to do anything but guess on the issue here.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Some problem with prefix wilcard search
Posted by tirupathi reddy <ti...@yahoo.com>.
Hello Erik,
The output from ant command is :
C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3>ant
Buildfile: build.xml
init:
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\dist
compile-core:
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build\classes\jav
a
[javac] Compiling 160 source files to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\
build\classes\java
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\FastCharStream.java:106: warning: [deprecation] getLine() in org.
apache.lucene.analysis.standard.CharStream has been deprecated
[javac] public final int getLine() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\FastCharStream.java:103: warning: [deprecation] getColumn() in or
g.apache.lucene.analysis.standard.CharStream has been deprecated
[javac] public final int getColumn() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\que
ryParser\FastCharStream.java:106: warning: [deprecation] getLine() in org.apache
.lucene.queryParser.CharStream has been deprecated
[javac] public final int getLine() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\que
ryParser\FastCharStream.java:103: warning: [deprecation] getColumn() in org.apac
he.lucene.queryParser.CharStream has been deprecated
[javac] public final int getColumn() {
[javac] ^
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 4 warnings
[rmic] RMI Compiling 1 class to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build
\classes\java
jar-core:
[jar] Building jar: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build\lucene-1.5
-rc1-dev.jar
default:
BUILD SUCCESSFUL
Total time: 13 seconds
The output from ant -Djavacc.home=c:/javacc javacc command is:
C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3>ant -Djavacc.home=c:/javacc javacc
Buildfile: build.xml
init:
javacc-check:
javacc-StandardAnalyzer:
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org
\apache\lucene\analysis\standard\StandardTokenizer.jj . . .
[java] Note: UNICODE_INPUT option is specified. Please make sure you create
the parser/lexer usig a Reader with the correct character encoding.
[java] Parser generated successfully.
[copy] Copying 3 files to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\or
g\apache\lucene\analysis\standard
javacc-QueryParser:
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org
\apache\lucene\queryParser\QueryParser.jj . . .
[java] Warning: Line 608, Column 3: Regular expression for WILDTERM can be
matched by the empty string ("") in lexical state DEFAULT. This can result in an
endless loop of empty string matches.
[java] Parser generated with 0 errors and 1 warnings.
javacc-HTMLParser:
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\demo\org
\apache\lucene\demo\html\HTMLParser.jj . . .
[java] Parser generated successfully.
javacc:
BUILD SUCCESSFUL
Total time: 3 seconds
And you told me to run the ant -Djavacc.home=c:/javacc clean javacc jar-core
So i run that command after issuing ant command instead of
ant -Djavacc.home=c:/javacc javacc.
And the build for that was failed.
And the output is:
C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3>ant -Djavacc.home=c:/javacc clean javacc j
ar-core
Buildfile: build.xml
clean:
[delete] Deleting directory C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build
[delete] Deleting directory C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\dist
init:
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\dist
javacc-check:
javacc-StandardAnalyzer:
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build\gen\org\apa
che\lucene\analysis\standard
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org
\apache\lucene\analysis\standard\StandardTokenizer.jj . . .
[java] Note: UNICODE_INPUT option is specified. Please make sure you create
the parser/lexer usig a Reader with the correct character encoding.
[java] File "TokenMgrError.java" does not exist. Will create one.
[java] File "ParseException.java" does not exist. Will create one.
[java] File "Token.java" does not exist. Will create one.
[java] File "CharStream.java" does not exist. Will create one.
[java] Parser generated successfully.
[copy] Copying 6 files to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\or
g\apache\lucene\analysis\standard
javacc-QueryParser:
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org
\apache\lucene\queryParser\QueryParser.jj . . .
[java] Warning: Line 608, Column 3: Regular expression for WILDTERM can be
matched by the empty string ("") in lexical state DEFAULT. This can result in an
endless loop of empty string matches.
[java] Parser generated with 0 errors and 1 warnings.
javacc-HTMLParser:
invoke-javacc:
[java] Java Compiler Compiler Version 3.2 (Parser Generator)
[java] (type "javacc" with no arguments for help)
[java] Reading from file C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\demo\org
\apache\lucene\demo\html\HTMLParser.jj . . .
[java] Parser generated successfully.
javacc:
init:
compile-core:
[mkdir] Created dir: C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\build\classes\jav
a
[javac] Compiling 160 source files to C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\
build\classes\java
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\StandardTokenizer.java:15: cannot find symbol
[javac] symbol : class Reader
[javac] location: class org.apache.lucene.analysis.standard.StandardTokenize
r
[javac] public StandardTokenizer(Reader reader) {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\StandardTokenizer.java:24: cannot find symbol
[javac] symbol : class IOException
[javac] location: class org.apache.lucene.analysis.standard.StandardTokenize
r
[javac] final public org.apache.lucene.analysis.Token next() throws ParseE
xception, IOException {
[javac]
^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\FastCharStream.java:106: warning: [deprecation] getLine() in org.
apache.lucene.analysis.standard.CharStream has been deprecated
[javac] public final int getLine() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\FastCharStream.java:103: warning: [deprecation] getColumn() in or
g.apache.lucene.analysis.standard.CharStream has been deprecated
[javac] public final int getColumn() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\ana
lysis\standard\StandardTokenizer.java:15: recursive constructor invocation
[javac] public StandardTokenizer(Reader reader) {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\que
ryParser\FastCharStream.java:106: warning: [deprecation] getLine() in org.apache
.lucene.queryParser.CharStream has been deprecated
[javac] public final int getLine() {
[javac] ^
[javac] C:\LUCENE-CURRENT\SOURCE\lucene-1.4.3\src\java\org\apache\lucene\que
ryParser\FastCharStream.java:103: warning: [deprecation] getColumn() in org.apac
he.lucene.queryParser.CharStream has been deprecated
[javac] public final int getColumn() {
[javac] ^
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 3 errors
[javac] 4 warnings
BUILD FAILED
Thanx,
MTREDDY
Tirupati Reddy Manyam
24-06-08,
Sundugaullee-24,
79110 Freiburg
GERMANY.
Phone: 00497618811257
cell : 004917624649007
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Some problem with prefix wilcard search
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Sep 19, 2005, at 4:41 AM, tirupathi reddy wrote:
> Hello,
> I am using Lucene for for searching in my application.
> My application needs prefix wildcard search also.
> But Lucene doesn't support this. So I changed in the QueryParser.jj
> file
> FROM:
> | <WILDTERM: <_TERM_START_CHAR>
> (<_TERM_CHAR> | ( [ "*", "?" ] ))* >
> To:
> | <WILDTERM: (<_TERM_CHAR> | ( [ "*", "?" ] ))* >
>
> And then I build it using ant and then by using
> command ant -Djavacc.home = C:/javac javacc
Try this command:
ant -Djavacc.home=c:/javacc clean javacc jar-core
> And both times it was saying build was successful.
Send us the output from Ant. Something operationally incorrect is
occurring.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org