Hi, I am not sure if I have to index using Field.Text or Field.Keyword. I know that :
Keyword-Isn't analyzed, but is indexed and stored in the index verbatim. This type is suitable for fields whose original value should be preserved in its entirety, such as URLs, file system paths, dates, personal names, Social Security numbers, telephone numbers, and so on. For example, we used the file system path in Indexer (listing 1.1) as a Keyword field. Text-Is analyzed, and is indexed. This implies that fields of this type can be searched against, but be cautious about the field size. If the data indexed is a String, it's also stored; but if the data (as in our Indexer example) is from a Reader, it isn't stored. This is often a source of confusion, so take note of this difference when using Field.Text. I have indexed the same value on the same field firstly like Field.Text and secondly like Field.Keyword. I am using QueryParser. These are the results of some test: ----------------------------------------------------------------TEST 1------------------------------------------------------------ FIELD ==> NAMEFILE; VALUE ==> name one -------------------------------------------------------------------------------------------------------------------------------------------------------------- Query Index like Field.Text Index like Field.Keyword -------------------------------------------------------------------------------------------------------------------------------------------------------------- NAMEFILE:name* OK OK NAMEFILE:one OK NO NAMEFILE:"name one" NO NO -------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------TEST 2----------------------------------------------------------------------------- FIELD ==> NAMEFILE;VALUE ==> NAME TWO -------------------------------------------------------------------------------------------------------------------------------------------------------------- Query Index like Field.Text Index like Field.Keyword -------------------------------------------------------------------------------------------------------------------------------------------------------------- NAMEFILE:NAME* OK NO NAMEFILE:TWO OK NO NAMEFILE:"NAME TWO" NO NO -------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------TEST 3------------------------------------------------------------------------------- FIELD ==> NAMEFILE; VALUE ==> name two -------------------------------------------------------------------------------------------------------------------------------------------------------------- Query Index like Field.Text Index like Field.Keyword -------------------------------------------------------------------------------------------------------------------------------------------------------------- NAMEFILE:name* OK OK NAMEFILE:two OK NO NAMEFILE:"name two" NO NO -------------------------------------------------------------------------------------------------------------------------------------------------------------- My questions are: 1.- I would like to search for the complete namefile with white spaces and I don´t know how. 2.-I don´t understand the behaviour or Keyword with uppercase and lowercase. Thanks in advance