I was happy to take the hit of storing the text twice.

I have created an aggregate field called "CONTENTS" that has all the other
fields concatenated together.
I also created a list of the other fields (because they can vary from doc to
doc) in another field "FIELDLIST"

I search this field and for any hits I get I retrieve the list of fields
from FIELDLIST and then go through retrieving each field in the list. For
each field I can then put it through the highlighter and if there are any
results I must have had a hit in that field so I display it.

What I wanted to achieve was to be able to search all fields in the document
(using the aggregate field) but when retrieving actually be able to find the
particular fields that had matches. Your requirements may be different!

-Gwyn

-----Original Message-----
From: Jairo Sánchez Menéndez [mailto:[EMAIL PROTECTED] 
Sent: 29 January 2006 18:18
To: java-user@lucene.apache.org
Subject: Searching over more than one Fields

Hi everybody,

Well I will explain you my problem:
I am indexing ".txt" files and basically I split each file in 
paragraphs, I mean, i create a Document for each file and within this 
Document I
add one Field named "px" for each paragraph (x) of the file.
My question is: after creating the index, now i want to do searches over 
the index, but what I want is searching a word over all paragraphs of 
all files, i.e.
searching the word in all Fields of all Documents.
I am using something like this, but doing so i can only put p1 or p2 or 
p3 ... in the Field parameter of the parse method, how can i search over 
all paragraphs??
Query query=QueryParser.parse(q, "   ", new WhitespaceAnalyzer());
Hits hits=is.search(query);

Thanks.

                
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to