You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Jairo Sánchez Menéndez <ja...@yahoo.es> on 2006/01/29 19:17:42 UTC
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Searching over more than one Fields
Posted by Chris Brown <ch...@redsky.ca>.
I'd suggest creating the index a little differently. How about creating each
paragraph as a document. Each document could have three fields: filename,
paragraph number and content.
With an index like this you'd be able to easily search one field for the
content, the hits could report which paragraph and file the content was
found in, plus you could do paragraph specific searches if you like.
Chris Brown
OrangePics - Simple, Safe Photo Sharing
http://www.orangepics.com/
----- Original Message -----
From: "Jairo Sánchez Menéndez" <ja...@yahoo.es>
To: <ja...@lucene.apache.org>
Sent: Sunday, January 29, 2006 2:17 PM
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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Searching over more than one Fields
Posted by Chris Brown <ch...@orangepics.com>.
I'd suggest creating the index a little differently. How about creating each
paragraph as a document. Each document could have three fields: filename,
paragraph number and content.
With an index like this you'd be able to easily search one field for the
content, the hits could report which paragraph and file the content was
found in, plus you could do paragraph specific searches if you like.
Chris Brown
OrangePics - Simple, Safe Photo Sharing
http://www.orangepics.com/
----- Original Message -----
From: "Jairo Sánchez Menéndez" <ja...@yahoo.es>
To: <ja...@lucene.apache.org>
Sent: Sunday, January 29, 2006 2:17 PM
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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Searching over more than one Fields
Posted by Chris Brown <ch...@orangepics.com>.
I'd suggest creating the index a little differently. How about creating each
paragraph as a document. Each document could have three fields: filename,
paragraph number and content.
With an index like this you'd be able to easily search one field for the
content, the hits could report which paragraph and file the content was
found in, plus you could do paragraph specific searches if you like.
Chris Brown
OrangePics - Simple, Safe Photo Sharing
http://www.orangepics.com/
----- Original Message -----
From: "Jairo Sánchez Menéndez" <ja...@yahoo.es>
To: <ja...@lucene.apache.org>
Sent: Sunday, January 29, 2006 2:17 PM
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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Searching over more than one Fields
Posted by Gwyn Carwardine <gw...@carwardine.net>.
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:jairochan82@yahoo.es]
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org