Hi All,
I'm indexing categories with this code:

for (Category category : item.getCategories()) { lucene_doc.add(new Field(
       "CATEGORY",
       category.getName(),
       Field.Store.NO,
Field.Index.UN_TOKENIZED)); }

And searching using the query:

String query = "CATEGORY:("+category.getName()+")";

I've configured to use the StandardAnalyzer both in the IndexWriter for the QueryParser.

Everything goes fine BUT with categories that contains whitespaces (or other chars that get tokenized).

* If category is "sport" - ok, I get the result from the search
* If category is "winter sport" - I get no result from search

I've tried with a number of search syntax:
+CATEGORY:"winter sport"
+CATEGORY:winter +CATEGORY:sport
+CATEGORY:(winter sport)
and other...
but none of them work.

What's wrong with that?
By the way, using the KeywordAnalyzer it works, but it is not the correct analyzer for my application.
Shouldn't the Analyzer be ignored for a Field.Index.UN_TOKENIZED field?

Thanks,
Roberto


Reply via email to