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 Rohit Kumar <ro...@gmail.com> on 2013/09/28 18:11:57 UTC

Section Search in SOLR

Hi,

I have following SOLR documents indexed.

<doc>
    <str name="id">1</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kaseya</str>
    </arr>
    <arr name="positionName">
      <str>Executive</str>
      <str>Technician</str>
    </arr>
<doc>

<doc>
    <str name="id">2</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kodak</str>
    </arr>
    <arr name="positionName">
      <str>Technician</str>
      <str>Executive</str>
    </arr>
<doc>


Company name and Position name are multivalued fields maintained in order.

The following is the solr query.
*fq=companyName:Boeing&fq=positionName:Executive* which returns both the
documents as expected.
What changes will i have to make to be able to search for
companyName:Boeing and positionName:Executive both at same indexes in the
corresponding multivalued fields i.e. should return me only doc id 1.


Thanks,
Rohit Kumar

Re: Section Search in SOLR

Posted by Rohit Kumar <ro...@gmail.com>.
Thanks Jack for quick reply.


Probably my question was not elaborate enough. Let me add more explanation.

*Option 1:
*
Even if I flatten my document to store separate *experiences* in
multivalued field, solr will still return me the doc id 1 and 2 if i query
: *fq=**experience:Boeing&fq=**experience:Executive*

<doc>
    <str name="id">1</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kaseya</str>
    </arr>
    <arr name="positionName">
      <str>Executive</str>
      <str>Technician</str>
    </arr>
    <arr name="experience">
      <str>Boeing, Executive</str>
      <str>Kaseya, Technician</str>
    </arr>
<doc>

<doc>
    <str name="id">2</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kodak</str>
    </arr>
    <arr name="positionName">
      <str>Technician</str>
      <str>Executive</str>
    </arr>
    <arr name="experience">
      <str>Boeing, Technician</str>
      <str>Kodak, Executive</str>
    </arr>
<doc>


*Option 2:

*
Storing separate experience in separate fields and generate query
q=(exp1:(Boeing AND Executive) OR exp2:(Boeing AND Executive)) and this can
be queried to return the docs with the expected match.

<doc>
    <str name="id">2</str>
   ...
    <str name="exp1">Boeing, Executive</str>
    <str name="exp2">Kodak, Executive</str>
<doc>
*

*
Please suggest.
*
*
I would just love to know how linkedin does it to show facets for people
working in company with titles.

Thanks




On Sat, Sep 28, 2013 at 9:58 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> "multivalued fields maintained in order"
>
> That is not a feature supported by Solr.
>
> Solr will maintain the order of an individual multivalued field and will
> return the values of that field in order, but makes no other use of the
> order.
>
> Ditto for "corresponding multivalued fields". Solr does not support any
> correspondence between multivalued fields.
>
> You must flatten your data your data to achieve any correspondence.
>
> Multivalued field are a powerful feature of Solr, but you must be
> extremely careful to use them only in moderation.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Rohit Kumar
> Sent: Saturday, September 28, 2013 12:11 PM
> To: solr-user@lucene.apache.org
> Subject: Section Search in SOLR
>
>
> Hi,
>
> I have following SOLR documents indexed.
>
> <doc>
>    <str name="id">1</str>
>    <arr name="companyName">
>      <str>Boeing</str>
>      <str>Kaseya</str>
>    </arr>
>    <arr name="positionName">
>      <str>Executive</str>
>      <str>Technician</str>
>    </arr>
> <doc>
>
> <doc>
>    <str name="id">2</str>
>    <arr name="companyName">
>      <str>Boeing</str>
>      <str>Kodak</str>
>    </arr>
>    <arr name="positionName">
>      <str>Technician</str>
>      <str>Executive</str>
>    </arr>
> <doc>
>
>
> Company name and Position name are multivalued fields maintained in order.
>
> The following is the solr query.
> *fq=companyName:Boeing&fq=**positionName:Executive* which returns both the
>
> documents as expected.
> What changes will i have to make to be able to search for
> companyName:Boeing and positionName:Executive both at same indexes in the
> corresponding multivalued fields i.e. should return me only doc id 1.
>
>
> Thanks,
> Rohit Kumar
>

Re: Section Search in SOLR

Posted by Jack Krupansky <ja...@basetechnology.com>.
"multivalued fields maintained in order"

That is not a feature supported by Solr.

Solr will maintain the order of an individual multivalued field and will 
return the values of that field in order, but makes no other use of the 
order.

Ditto for "corresponding multivalued fields". Solr does not support any 
correspondence between multivalued fields.

You must flatten your data your data to achieve any correspondence.

Multivalued field are a powerful feature of Solr, but you must be extremely 
careful to use them only in moderation.

-- Jack Krupansky

-----Original Message----- 
From: Rohit Kumar
Sent: Saturday, September 28, 2013 12:11 PM
To: solr-user@lucene.apache.org
Subject: Section Search in SOLR

Hi,

I have following SOLR documents indexed.

<doc>
    <str name="id">1</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kaseya</str>
    </arr>
    <arr name="positionName">
      <str>Executive</str>
      <str>Technician</str>
    </arr>
<doc>

<doc>
    <str name="id">2</str>
    <arr name="companyName">
      <str>Boeing</str>
      <str>Kodak</str>
    </arr>
    <arr name="positionName">
      <str>Technician</str>
      <str>Executive</str>
    </arr>
<doc>


Company name and Position name are multivalued fields maintained in order.

The following is the solr query.
*fq=companyName:Boeing&fq=positionName:Executive* which returns both the
documents as expected.
What changes will i have to make to be able to search for
companyName:Boeing and positionName:Executive both at same indexes in the
corresponding multivalued fields i.e. should return me only doc id 1.


Thanks,
Rohit Kumar