We ended up using String newquery = query.replace(query, :,
with space in quotes after the :. It worked great. Now results come back
even if you use
colon in the query. And one can still use : as a special operator if there
is no space
afterwards. Great suggestion.
Thanks!
Felix
I'd *strongly* advise doing it the simple way, that is, your replace.
1 it's simple and understandable.
2 next time you upgrade Lucene you, or the next poor programmer, will have
to remember/reimplement your change to the parser.
3 How will you insure that others in your organization (and you 6
: String newquery = query.replace(query, : , );
you should be able to usea regex like so...
String newquery = query.replaceAll(:\\b, :);
...(i may have some extra/missing backslashes) to ensure that literal :
in your input which are followed by word boundaries are escaped fro mteh
Yes. thank you. How did you make that modification not to treat : as a
field-name terminator?
Is it using this Or some other way?
String newquery = query.replace(query, :, );
Thank you,
Felix
Antony Bowesman [EMAIL PROTECTED] wrote: Not sure if you're still after a
solution, but I had a
Felix Litman wrote:
Yes. thank you. How did you make that modification not to treat : as a
field-name terminator?
Is it using this Or some other way?
I removed the : handling stuff from QueryParser.jj in the method:
Query Clause(String field) :
I removed this section
---
[
OK. Thank you. We'll have to consider using this approach.
I guess the drawback here is that : will not longer work as a field
operator. ?:-(
We were also considering using the following approach.
String newquery = query.replace(query, : , );
It seems this way a colon
Not sure if you're still after a solution, but I had a similar issue and I
modified QueryParser.jj to not treat : as a field name terminator, so work:
would then just be given as work: to the analyzer and treated as a search term.
Antony
Felix Litman wrote:
We want to be able to return a
Is there a simple way to turn off field-search syntax in the Lucene parser, and
have Lucene recognize words ending in a colon : as search terms instead?
Such words are very common occurrences for our documents (or any plain text),
but Lucene does not seem to find them. :-(
Thank you,
Felix
I've got to ask why you'd want to search on colons. Why not just index the
words without colons and search without them too? Let's say you index the
word work: Do you really want to have a search on work fail?
By and large, you're better off indexing and searching without
punctuation
Best
Yes, thank you. That would be a good solution. But we are using Lucene's
Standard Analyzer. It seems to index words with colons : and other
punctuation by default. Is there a simple way to have the Analyzer not to
index colons specifically and punctuation in general?
Erick Erickson [EMAIL
StandardAnalyzer should not be indexing punctuation from my
experience...instead something like old:fart would be indexed as old and
fart. QueryParser will then generate a query of old within 1 of fart for
the query old:fart. This is the case for all punctuation I have run
into. Things like
We want to be able to return a result regardless if users use a colon or not in
the query. So 'work:' and 'work' query should still return same result.
With the current parser if a user enters 'work:' with a : , Lucene does not
return anything :-(. It seems to me the Lucene parser issue
On Jan 28, 2007, at 3:47 PM, Felix Litman wrote:
We want to be able to return a result regardless if users use a
colon or not in the query. So 'work:' and 'work' query should
still return same result.
With the current parser if a user enters 'work:' with a : ,
Lucene does not return
Felix Litman wrote:
We want to be able to return a result regardless if users use a colon or not in
the query. So 'work:' and 'work' query should still return same result.
With the current parser if a user enters 'work:' with a : , Lucene does not return
anything :-(. It seems to me the
great suggestion and Eric's also earlier. Thank you.
Felix
Michael D. Curtin [EMAIL PROTECTED] wrote: Felix Litman wrote:
We want to be able to return a result regardless if users use a colon or not
in the query. So 'work:' and 'work' query should still return same result.
With the
15 matches
Mail list logo