lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wal...@Cyveillance.com
Subject RE: Problem with match on a non tokenized field.
Date Fri, 09 Jul 2004 20:54:09 GMT
I do not know how to work around that.

It is indeed an interesting situation that would require more understanding
as to how the analyzer (in this case NullAnalyzer) interacts with the
special characters such as the * and ~.

You could try using the whitespace analyzer instead of the nullanalyzer!

-Will

-----Original Message-----
From: Polina Litvak [mailto:plitvak@casebank.com]
Sent: Friday, July 09, 2004 4:45 PM
To: 'Lucene Users List'
Subject: RE: Problem with match on a non tokenized field.


Thanks a lot for your help. I've done what you suggested and it works
great except in this particular case:

I am trying to search for something like "abc-ef*" - i.e. I want to find
all fields that start with: "abc-ef".
I use PerFieldAnalyzerWrapper together with NullAnalyzer to make sure
this field doesn't get tokenized on the "-", but at the same time I need
the analyzer to realize that '*' is the wildcard search, not part of the
field value itself.

Would you know how to work around this ?

Thank you,
Polina

-----Original Message-----
From: wallen@Cyveillance.com [mailto:wallen@Cyveillance.com] 
Sent: July 8, 2004 1:10 PM
To: lucene-user@jakarta.apache.org
Subject: RE: Problem with match on a non tokenized field.

The PerFieldAnalyzerWrapper is constructed with your default analyzer,
suppose this is the analyzer you use to tokenize.  You then call the
addAnalyzer method for each non-tokenized/keyword fields.

In the case below, url is a keyword, all other fields are tokenized:

PerFieldAnalyzerWrapper analyzer  = new
org.apache.lucene.analysis.PerFieldAnalyzerWrapper(new MyAnalyzer());
analyzer.addAnalyzer("url", new NullAnalyzer());
query = QueryParser.parse(searchQuery,"contents",analyzer);



-----Original Message-----
From: Polina Litvak [mailto:plitvak@casebank.com]
Sent: Thursday, July 08, 2004 10:19 AM
To: 'Lucene Users List'
Subject: RE: Problem with match on a non tokenized field.


Thanks a lot for your help.
I have one more question:

How would you handle a query consisting of two fields combined with a
Boolean operator, where one field is only indexed and stored (a Keyword)
and another is tokenized, indexed and store ?
Is it possible to have parts of the same query analyzed with different
analyzers ?


-----Original Message-----
From: wallen@Cyveillance.com [mailto:wallen@Cyveillance.com] 
Sent: July 7, 2004 4:38 PM
To: lucene-user@jakarta.apache.org
Subject: RE: Problem with match on a non tokenized field.

Use org.apache.lucene.analysis.PerFieldAnalyzerWrapper

Here is how I use it:

                PerFieldAnalyzerWrapper analyzer  = new
org.apache.lucene.analysis.PerFieldAnalyzerWrapper(new MyAnalyzer());
                analyzer.addAnalyzer("url", new NullAnalyzer());
                try 
                {
                        query = QueryParser.parse(searchQuery,
"contents",
analyzer);

-----Original Message-----
From: Polina Litvak [mailto:plitvak@casebank.com]
Sent: Wednesday, July 07, 2004 4:20 PM
To: lucene-user@jakarta.apache.org
Subject: Problem with match on a non tokenized field.


I have a Lucene Document with a field named Code which is stored 
and indexed but not tokenized. The value of the field is ABC5-LB.
The only way I can match the field when searching is by entering 
Code:"ABC5-LB" because when I drop the quotes, every Analyzer I've tried
using breaks my
query into Code:ABC5 -Code:LB.
 
I need to be able to match this field by doing something like
Code:ABC5-L*, therefore always using quotes is not an option.
 
How would I go about writing my own analyzer that will not tokenize the
query ?
 
Thanks,
Polina
 

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


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

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


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

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


Mime
View raw message