Should I index the field that use in fq field?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Should I index the field that use in fq field?

GTHell
I'm doing a lot of filter query in fq. My search is something like
'q=*:*&fq=..function on a few fields..' . Do I need to only index those
field and use FL to get other result or do I need to index everything?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Should I index the field that use in fq field?

Nicolas Franck
Yes,

every field you query has to be "indexed"

every field you need to be returned in the response has to be "stored"

the parameter "fl" can only return fields that are "stored". Other fields
given are simply ignored.



> On 13 Mar 2020, at 13:15, GTHell <[hidden email]> wrote:
>
> I'm doing a lot of filter query in fq. My search is something like
> 'q=*:*&fq=..function on a few fields..' . Do I need to only index those
> field and use FL to get other result or do I need to index everything?
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply | Threaded
Open this post in threaded view
|

Re: Should I index the field that use in fq field?

GTHell
Does it mean that if the FL field is the result of some function, do I need
to only Index those fields right? Or do I need to stored it also?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Should I index the field that use in fq field?

Erick Erickson
In reply to this post by Nicolas Franck
This isn’t quite right. The fields do _not_ need indexed=true if (and only if) they
have docValues=true in order to use function queries. But it’ll consume lots of
on-heap resources.

In fact, depending on the version of Solr (which you have not told us), it’s even
possible to search on a field with docValues=true indexed=false. But it’s extremely
inefficient.

Which causes you problems when you extrapolate from small data sets to
production. Something that works fine with 100K docs blows up when you
start putting 10M docs in.

So here’s the rule, for efficiency (both run-time and memory):

1> indexed=“true” for anything you search on. I.e. q=field:value or even fq=field:value
2> docValues=“true” for anything you use for function queries, sorting, grouping, or faceting.

Of course you can specify both for any given field.

Best,
Erick


> On Mar 13, 2020, at 8:29 AM, Nicolas Franck <[hidden email]> wrote:
>
> Yes,
>
> every field you query has to be "indexed"
>
> every field you need to be returned in the response has to be "stored"
>
> the parameter "fl" can only return fields that are "stored". Other fields
> given are simply ignored.
>
>
>
>> On 13 Mar 2020, at 13:15, GTHell <[hidden email]> wrote:
>>
>> I'm doing a lot of filter query in fq. My search is something like
>> 'q=*:*&fq=..function on a few fields..' . Do I need to only index those
>> field and use FL to get other result or do I need to index everything?
>>
>>
>>
>> --
>> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>

Reply | Threaded
Open this post in threaded view
|

Re: Should I index the field that use in fq field?

Erick Erickson
In reply to this post by GTHell
FL has two flavors, neither of them have to do with index=true|false.

To return a field in the FL list, specify stored=“true”.

To return the results of a _function_, you can do that with “pseudo-fields”, please look in the reference guide.

Best,
Erick


> On Mar 13, 2020, at 8:42 AM, GTHell <[hidden email]> wrote:
>
> Does it mean that if the FL field is the result of some function, do I need
> to only Index those fields right? Or do I need to stored it also?
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html