I just ran into a little problem while trying to query for a document
looking for a term that had been indexed using a Keyword field...
My application is using the StandardAnalyzer and the QueryParser to
search the index, so my query looked something like this:
kw:FOOBAR
not surprisingly (now that I know what's going on) I wasn't getting any
hits from this search (because the QueryParser was normalizing the
query term be "foobar" when it had been indexed as "FOOBAR")
I know that i could create my own query to search for "FOOBAR", but it
seems reasonable to add a LITERAL operator so that keywords can be
searched using the QueryParser, no?
Here's the diff for my stab at implementing it:
diff -r1.25 QueryParser.jj
319c319
< "[", "]", "\"", "{", "}", "~", "*", "?" ] >
---
> "[", "]", "\"", "{", "}", "~", "*", "?",
"'" ] >
321c321
< "[", "]", "\"", "{", "}", "~", "*", "?" ]
---
> "[", "]", "\"", "{", "}", "~", "*", "?",
"'" ]
350a351
> | <LITERAL: "'" (~["'"])+ "'">
527a529,533
> }
> | term=<LITERAL>
> [ <CARAT> boost=<NUMBER> ]
> {
> q = new TermQuery(new Term(field, term.image.substring(1,
term.image.length()-1)));
I'm not so sure I like using the single quote here, but it was
available...
What do people think? Is this useful to others?
- matt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Multiple languages in same index? Randy Darling
- RE: Multiple languages in same index? Sale, Doug
- Re: literal operator? Matthew King
- Re: literal operator? Otis Gospodnetic
- Re: literal operator? Terry Steichen
- Re: literal operator? Matthew King
- Re: literal operator? Otis Gospodnetic
- Re: literal operator? Tatu Saloranta
- Re: literal operator? Terry Steichen
- Re: literal operator? Erik Hatcher
- RE: Multiple languages in same index? John Cwikla
- RE: Multiple languages in same index? Leo Galambos
