Hello,I'm not sure if it's the smartest solution, but if
your request go throught a programming layer, you could
rewrite it using regular expression :
query="apple" is rewrited in
query="title:apple AND text:apple", for example.
Don't know if it's clever performancewise, but it works
fine, although I would love to use a more integrated
solution...Here what i do, in php : private function
parseQuery( $query ){ $reservedWords = array( 'and',
'or', 'not' ); $operator = '+|-';
$completion = '*?~'; if (
sizeof($this->searchFields)>0 ){
//$this->searchFields = fields to be searched for
if ( preg_match_all( '#('.$operator.')?(bw+b ?(([^>]
*)|"[^"]*"|bw+[w'.$completion.']*b['.$co
mpletion.']?)#', $query, $matches, PREG_OFFSET_CAPTURE ) ){
// $matches : 0=>complet : 1=>operator ;
2=>field ; 3=>term / 0=>value 1=>offset
$newQuery = $query; for (
$i=sizeof($matches[0])-1; $i>=0; $i-- ){
if ( !in_array( strtolower($matches[3][$i][0]),
$reservedWords ) and !$matches[2][$i][0] ){
if ( $nbField=sizeof($this->searchFields) ){
$term =
$matches[1][$i][0].(($nbField>1)?'(':'');
foreach ( $this->searchFields as
$key=>$field ){ if
($key>0) $term .= ' OR ';
$term .=
"(".$field.":".$matches[3][$i][0]."
)"; }
$term .= (($nbField>1)?')':'');
$query = substr_replace( $query, $term,
$matches[0][$i][1], strlen($matches[0][$i][0]) );
} } }
} } return $query; }Hope this can
help.Pierre-Yves Landron> From: lucenelist2007 danielnaber.de> To: solr-user lucene.apache.org> Subject: searching multiple
fields> Date: Tue, 31 Jul 2007 00:34:08 +0200> >
Hi,> > I want to search multiple fields by default
(which is no supported by > StandardRequestHandler), but
I also want to be able to use Lucene's > boolean syntax
(AND/OR/NOT). This doesn't seem to be supported by >
DisMaxRequestHandler. I will need to copy or extend
StandardRequestHandler > and modify it, including the
query parser it calls, or am I missing an > easier
alternative?> > Regards> Daniel> > -- >
http://www.danielnaber.de
a>
____________________________________________________________
_____
Play free games, earn tickets, get cool prizes! Join Live
Search Club.
http://club.live.com/home.aspx?icid=CLUB_wlmailtextlink
a> |