You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by George Abraham <ge...@gmail.com> on 2007/04/11 15:49:32 UTC

filter query: comparing values between fields

Hi all,
I am using the DisMaxRequestHandler. Is there any way to use the fq param to
compare two fields? For example, each of the documents in the index have two
fields which are slightly related to each other within the context of the
document; say these fields are: blah1 and blah2. When I do a search, I want
the fq param in solrconfig.xml to look like this:

<str name="fq">
   blah1:blah2
</str>


Of course the above code won't work right now, but is there any way to
specify that blah2 is actually a field and not a value?


Thanks,
George

Re: filter query: comparing values between fields

Posted by Chris Hostetter <ho...@fucit.org>.
: You know, that's ultimately what I have done. My thinking is that doing
: field comparisons could be too intensive an operation anyway.

It would be hard to do if you were willing to use the FieldCache for each
of the fields, a FunctionQuery could be written for it fairly easily ...
but i'm sure that indexing a single "is_equal" would be a lot faster
either way.



-Hoss


Re: filter query: comparing values between fields

Posted by George Abraham <ge...@gmail.com>.
You know, that's ultimately what I have done. My thinking is that doing
field comparisons could be too intensive an operation anyway.

Thanks,
George

On 4/11/07, Yonik Seeley <yo...@apache.org> wrote:
>
> On 4/11/07, George Abraham <ge...@gmail.com> wrote:
> > I am using the DisMaxRequestHandler. Is there any way to use the fq
> param to
> > compare two fields?
>
> Find all docs where fielda=fieldb is not currently supported (in
> Lucene or Solr), but it could be in the future if it solves a common
> enough problem.
>
> Do you have many such fields you compare like that?
> If you are only comparing fielda and fieldb, then you could index another
> field
> fielda_is_fieldb:true for documents when the values match.
>
> -Yonik
>

Re: filter query: comparing values between fields

Posted by Yonik Seeley <yo...@apache.org>.
On 4/11/07, George Abraham <ge...@gmail.com> wrote:
> I am using the DisMaxRequestHandler. Is there any way to use the fq param to
> compare two fields?

Find all docs where fielda=fieldb is not currently supported (in
Lucene or Solr), but it could be in the future if it solves a common
enough problem.

Do you have many such fields you compare like that?
If you are only comparing fielda and fieldb, then you could index another field
fielda_is_fieldb:true for documents when the values match.

-Yonik