search in all fields

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

search in all fields

David-317
Hi all:
     I study Lucene and I want build search on all the fields, I find
MultiFieldQueryParser can search on multiple fields, but we must specify
fields. maybe we can add a field named all_field that contain all the fields
when indexing, but it make the index file larger.
    so how to make search on all fields without specify any fields ?
Appreciate your help!
--
David
Reply | Threaded
Open this post in threaded view
|

Re: search in all fields

delphi329
Here is my experience of getting a good search relevancy: pre processing is paramount.  Pre process your data and using perl is much powerful and flexible then putting all the logic in a customized analyzer.  And if you want to search multiple fields, create a field called "all" and cat all the data there.  It is much better than using MultiFieldQuery.  MultiFieldQuery just permutates your query with all default fields.  If you have more than 3 default fields, the query starts to look unnecessarily complex.  However, there is one case that MultiFieldQuery is needed: if you can't use the same tokenizer/analyzer for all default fields.

john

----- Original Message ----
From: David <[hidden email]>
To: [hidden email]
Sent: Thursday, January 18, 2007 12:54:20 AM
Subject: search in all fields

Hi all:
     I study Lucene and I want build search on all the fields, I find
MultiFieldQueryParser can search on multiple fields, but we must specify
fields. maybe we can add a field named all_field that contain all the fields
when indexing, but it make the index file larger.
    so how to make search on all fields without specify any fields ?
Appreciate your help!
--
David





 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: search in all fields

Karl Wettin
In reply to this post by David-317

18 jan 2007 kl. 09.54 skrev David:

> Hi all:
>     I study Lucene and I want build search on all the fields, I find
> MultiFieldQueryParser can search on multiple fields, but we must  
> specify
> fields. maybe we can add a field named all_field that contain all  
> the fields
> when indexing, but it make the index file larger.
>    so how to make search on all fields without specify any fields ?
> Appreciate your help!

You can use the IndexReader to see what fields is in an index.

<http://lucene.apache.org/java/docs/api/org/apache/lucene/index/ 
IndexReader.html#getFieldNames
(org.apache.lucene.index.IndexReader.FieldOption)>

<http://lucene.apache.org/java/docs/api/org/apache/lucene/index/ 
IndexReader.FieldOption.html>

HTH

--
karl

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]