lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Searching UN_TOKENIZED fields
Date Thu, 15 Jun 2006 13:56:31 GMT

I have a field indexed as follows:

new Field(name, value, Store.YES, Index.UN_TOKENIZED)

I would like to search this field for exact match of
the query term. Thus if, for instance in the above
code snippet:

  String name="PROJECT";
  String value="Apache Lucene";

I would like to get a hit in the following case:
   query is PROJECT:"apache lucene"
OR query is PROJECT:"Apache Lucene"
OR query is PROJECT:"Apache Luc*"

...but not in the following case:
   query is: PROJECT:apache
OR query is: PROJECT:lucene

With the Indexing call as above, and a query string of
PROJECT:"Apache Lucene" I get 0 hits. I do get hits if
I create the Field as TOKENIZED, but then it also
matches the query PROJECT:apache which is not what I

It is my understanding that I'm indexing correctly,
but when I query, I need to indicate to the
QueryParser that it should not tokenize the query
Since the call:
Term[] terms = ((PhraseQuery) query).getTerms();

returns 2 terms, which for the above example are:
"Apache" and "Lucene"

Any ideas on how I can make this work?

~ amol

~ They have even applied logic to probability and vice versa. ~

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message