lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morus Walter <morus.wal...@tanto.de>
Subject Re: a search like Google
Date Fri, 13 Feb 2004 06:43:07 GMT
Nicolas Maisonneuve writes:
> hy, 
> i have a index with the fields :
> title 
> author
> content 
> 
> i would make the same search type than Google  ( a form with a textfiel). When the user
search "i love lucene" (it's not a phrase query  but just the text in the textfield ), i would
like search  in all the index fields but with a specific weight boost for each field. In this
example title weight=2, author=1 content=1
> 
> the results would be (i suppose  the default operator is "and") :  (title:i^2 author:i
content:i) +(title:love^2 author:love content:love) +(title:lucene^2 author:lucene content:lucene)
> 
> but must i modify the QueryParser  or is there a different way for do this ?
> ( because i modified the QueryParser and it's work but if there is a cleaner way to do
this , i take it ! )
> 
If you want to use query parser you can parse the query with different
default fields, set boost factors on the resulting queries and join them
with a boolean query.
This will give you
(+title:i +title:love +title:lucene)^2 (+author:i +author:love +author:lucene) (+content:i
+content:love +content:lucene)

I don't if there are subtle differences between your query and this one, but
it should be basically the same.

Apart from the boost factors, that's AFAIK what multi field query parser
does. Maybe it would be usefull to extend multi field query parser to 
handle different boosts factors.

If you just want to allow search terms and none of the other constructs 
query parser handles, I would use David Spencer suggestion though.

Morus

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


Mime
View raw message