John john <[EMAIL PROTECTED]> wrote on 28/07/2006 06:36:19: > Hello, > > I tried to add a field like that > field = new Field("number", "1", Field.Store.YES,Field.Index.UN_TOKENIZED); > > so i should be indexed and to analyzed? my writer is > writer = new IndexWriter(INDEX_DIR, new StandardAnalyzer(), true); > > but according to the javadoc it should be alright and searching > with "number:1" should return resultats? Where i'm wrong?
Seems that should be working. Having "number:1" as query text suggests that QueryParser.parse() was used to get a query object, i.e. the query text is analyzed - which is inconsistent with an UN_TOKENIZED field. Consider using TermQuery to avoid tokenizing the query text: Query q = new TermQuery(new Term("number","1")); However this cannot explain why no results are returned, since the string "1" would generate the token "1" (well, "number:1") also with analysis. Perhaps its the common problem of not closing indexWriter after adding the doc or not re-opening searcher after closing the writer... - Doron --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]