Hi David,

We tried using copyfields, and we can get this to work, but it's not
exactly what we want because we need to use a common type. E.g.,

================================
<!-- REGULAR FIELDS -->
<field name="id" type="simple" indexed="true" stored="true" required="true"
multiValued="false" />
<field name="name" type="simple" indexed="true" stored="false"
required="false" multiValued="false" />
<field name="organism" type="complex" indexed="true" stored="false"
required="false" multiValued="false" />

<!-- DF FIELD  -->
<field name="content" type="complex" indexed="true" stored="false"
multiValued="true" />

<!-- COPY FIELDS -->
<copyField source="id" dest="content" />
<copyField source="name" dest="content" />
<copyField source="organism" dest="content" />
================================

Then if our "df" is specified as the "content" field, we can search over
"id", "name" and "organism" in one swoop. However, "content" has a
different type to "id" and "name", and so our search results might be
different than if we had searched directly on "id" or "name".

e.g.,
q=id:value1 // hits id field, which uses the "simple" type
q=value1 // hits content field, which uses the "complex" type
... so results might differ between the two queries

I hope this clarifies our question?

Best,

Edd

--------------------
Edward Turner


On Tue, 11 Aug 2020 at 15:03, David Hastings <hastings.recurs...@gmail.com>
wrote:

> why not use a copyfield for indexing?
>
> On Tue, Aug 11, 2020 at 9:59 AM Edward Turner <eddtur...@gmail.com> wrote:
>
> > Hi all,
> >
> > Is it possible to have multiple "df" fields? (We think the answer is no
> > because our experiments did not work when adding multiple "df" values to
> > solrconfig.xml -- but we just wanted to double check with those who know
> > better.) The reason we would like to do this is that we have two main
> field
> > types (with different analyzers) and we'd like queries without a field to
> > be searched over both of them. We could also use copyfields, but this
> would
> > require us to have a common analyzer, which isn't exactly what we want.
> >
> > An alternative solution is to pre-process the query prior to sending it
> to
> > Solr, so that queries with no field are changed as follows:
> >
> > q=value -> q=(field1:value OR field2:value)
> >
> > ... however, we feel a bit uncomfortable doing this though via String
> > manipulation.
> >
> > Is there an obvious way we should tackle this problem that we are missing
> > (e.g., which would be cleaner/safer and perhaps works at the Query object
> > level)?
> >
> > Many thanks and best wishes,
> >
> > Edd
> >
>

Reply via email to