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 Rob Young <bu...@gmail.com> on 2005/10/20 20:20:47 UTC

Search on all fields in a document

Hi,

If I have a document with a number of fields in it, is there a way to 
say that I want to search for a term across all those fields without 
stating the terms explicitly?

Detail:

I have multiple different types of products (cds, dvds, games, books 
etc.) each different product has different fields in it's document but 
all are indexed in the same index. This works for advanced searches but 
I would like to have a simple search where the user just whacks in a 
string (say Micheal Jackson) and the search would search through all 
terms of all documents and return cds by Micheal Jackson, music dvds by 
him, his biography perhaps, and maybe even a book on how to get away 
with pedophilia ;)

Any ideas?

Cheers
Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Search on all fields in a document

Posted by Benjamin Ragheb <ra...@mayaviz.com>.
Rob Young wrote:

> Is there no way to say "search on all searchable fields in every 
> document in the index" without explicitly providing a list of "all 
> searchable fields"?

You can programmatically get the list of searchable fields by calling 
fieldNames(true) on IndexReader.  From there it shouldn't be too hard to 
generate a query that searches all the fields.

-- Ben


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Search on all fields in a document

Posted by Rob Young <bu...@gmail.com>.
Chris Hostetter wrote:

>There is some advice on this in the FAQ...
>
>http://wiki.apache.org/jakarta-lucene/LuceneFAQ#head-300f0756fdaa71f522c96a868351f716573f2d7
>
Is there no way to say "search on all searchable fields in every 
document in the index" without explicitly providing a list of "all 
searchable fields"?

Cheers
Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Search on all fields in a document

Posted by Chris Hostetter <ho...@fucit.org>.
:
: If I have a document with a number of fields in it, is there a way to
: say that I want to search for a term across all those fields without
: stating the terms explicitly?

There is some advice on this in the FAQ...

http://wiki.apache.org/jakarta-lucene/LuceneFAQ#head-300f0756fdaa71f522c96a868351f716573f2d77


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org