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 Gusenbauer Stefan <gu...@eduhi.at> on 2005/03/21 15:25:48 UTC
Multiple Field Queries
Hello,
at the moment i cannot search through the mailinglist archives so i will
bother you. I will search over multiple fields for example content and
filename. The MultiFieldQueryParser is not applicable for me so i create
the query syntax programmatically. The querystring is parsed with the
QueryParser i use it in this example two times for content and filename
the resulting query. Then i combine them with BooleanQuery add the
resulting string is for example +content:test +filename:test. The
problem here is i would like to construct a query like (+content:test)
OR (+filename:test). Is the only alternative to extend the boolean query
to the string and make some string operations above it and pass it
through the QueryParser again?
Thanks
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Multiple Field Queries
Posted by Gusenbauer Stefan <gu...@eduhi.at>.
Aad Nales wrote:
> Perhaps i misunderstand but it seems to me that if you execute the add
> with two times a false value you will end up with the required result.
>
> (content:test) (filename:test)
>
> which is equivalent to your requested query.
>
> hope this helps,
> Aad Nales
>
>
> Gusenbauer Stefan wrote:
>
>> Hello,
>> at the moment i cannot search through the mailinglist archives so i
>> will bother you. I will search over multiple fields for example
>> content and filename. The MultiFieldQueryParser is not applicable for
>> me so i create the query syntax programmatically. The querystring is
>> parsed with the QueryParser i use it in this example two times for
>> content and filename the resulting query. Then i combine them with
>> BooleanQuery add the resulting string is for example +content:test
>> +filename:test. The problem here is i would like to construct a query
>> like (+content:test) OR (+filename:test). Is the only alternative to
>> extend the boolean query to the string and make some string
>> operations above it and pass it through the QueryParser again?
>> Thanks
>> Stefan
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
>
thanks
add(query,false,false) works now. The failure was because i added a
field to all documents for searching with a datefile. therefore there
were always all documents returned.
stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Multiple Field Queries
Posted by Aad Nales <aa...@rotterdam-cs.com>.
Perhaps i misunderstand but it seems to me that if you execute the add
with two times a false value you will end up with the required result.
(content:test) (filename:test)
which is equivalent to your requested query.
hope this helps,
Aad Nales
Gusenbauer Stefan wrote:
> Hello,
> at the moment i cannot search through the mailinglist archives so i
> will bother you. I will search over multiple fields for example
> content and filename. The MultiFieldQueryParser is not applicable for
> me so i create the query syntax programmatically. The querystring is
> parsed with the QueryParser i use it in this example two times for
> content and filename the resulting query. Then i combine them with
> BooleanQuery add the resulting string is for example +content:test
> +filename:test. The problem here is i would like to construct a query
> like (+content:test) OR (+filename:test). Is the only alternative to
> extend the boolean query to the string and make some string operations
> above it and pass it through the QueryParser again?
> Thanks
> Stefan
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org