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 blopez <ba...@hotmail.com> on 2012/11/07 10:50:11 UTC

About solr fields (dynamic query)

Hi all,

I'm facing some problems with solr fields at query time. Let's see a
simplified example.

I have the fields A, B and C. In a relational DB, it's possible to launch a
(let's say dynamically) query: SELECT * FROM wherever WHERE wherever.A +
wherever.B = wherever.C

I'm trying to do this in Solr but I don't know if it's possible. Would be
something like C:A+B but, obviously, Solr takes 'A+B' as a string and it
does not work.

Is there any approach to do this?

Regards,
Borja.



--
View this message in context: http://lucene.472066.n3.nabble.com/About-solr-fields-dynamic-query-tp4018684.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: About solr fields (dynamic query)

Posted by Luis Cappa Banda <lu...@gmail.com>.
Hello!

In my opinion, you are trying to use Solr as a complete and classic
database but the thing is that the best scenario where Solr rocks is just
for fast search data access. Thus, you just should index those data
candidate to be searched for. My personal suggestion is that you think
about how to divide (even replicate if necessary)  the data that you will
usually search for in Solr and the persistent data in a persistent (classic
or not) database.

 If you have to do some computation, calcs, etc. with the data stored:

1. You should use that relational database to execute the dynamic query.
2. You can run some batch cron process that executes the dynamic query and
then index the results in Solr in a defined field - let´s suppose it´s
called *calc_result*. Then, you can search for that results easy and
quickly with a Solr query similar to: q=calc_result:[ startRange TO
finishRange]

Regards,

    Luis Cappa.


2012/11/7 Jack Krupansky <ja...@basetechnology.com>

> With Solr, you would need to pre-compute any computations in query
> expressions and index them for direct matching. So, you would need a field
> which was indexed with the sum of the values of the other two fields.
>
> -- Jack Krupansky
>
> -----Original Message----- From: blopez
> Sent: Wednesday, November 07, 2012 1:50 AM
> To: solr-user@lucene.apache.org
> Subject: About solr fields (dynamic query)
>
>
> Hi all,
>
> I'm facing some problems with solr fields at query time. Let's see a
> simplified example.
>
> I have the fields A, B and C. In a relational DB, it's possible to launch a
> (let's say dynamically) query: SELECT * FROM wherever WHERE wherever.A +
> wherever.B = wherever.C
>
> I'm trying to do this in Solr but I don't know if it's possible. Would be
> something like C:A+B but, obviously, Solr takes 'A+B' as a string and it
> does not work.
>
> Is there any approach to do this?
>
> Regards,
> Borja.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.**
> nabble.com/About-solr-fields-**dynamic-query-tp4018684.html<http://lucene.472066.n3.nabble.com/About-solr-fields-dynamic-query-tp4018684.html>
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 

- Luis Cappa

Re: About solr fields (dynamic query)

Posted by Jack Krupansky <ja...@basetechnology.com>.
With Solr, you would need to pre-compute any computations in query 
expressions and index them for direct matching. So, you would need a field 
which was indexed with the sum of the values of the other two fields.

-- Jack Krupansky

-----Original Message----- 
From: blopez
Sent: Wednesday, November 07, 2012 1:50 AM
To: solr-user@lucene.apache.org
Subject: About solr fields (dynamic query)

Hi all,

I'm facing some problems with solr fields at query time. Let's see a
simplified example.

I have the fields A, B and C. In a relational DB, it's possible to launch a
(let's say dynamically) query: SELECT * FROM wherever WHERE wherever.A +
wherever.B = wherever.C

I'm trying to do this in Solr but I don't know if it's possible. Would be
something like C:A+B but, obviously, Solr takes 'A+B' as a string and it
does not work.

Is there any approach to do this?

Regards,
Borja.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/About-solr-fields-dynamic-query-tp4018684.html
Sent from the Solr - User mailing list archive at Nabble.com.