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 Pawan Darira <pa...@gmail.com> on 2011/06/09 06:14:23 UTC

Multiple Values not getting Indexed

Hi

I am trying to index 2 fields with multiple values. BUT, it is only putting
1 value for each & ignoring rest of the values after comma(,). I am fetching
query through DIH. It works fine if i have only 1 value each of the 2 fields

E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
& Field2 - Chandigarh,Gurgaon,New
Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others

*Schema.xml*

<field name="city_type" type="text" indexed="true" stored="true"/>
<field name="city_desc" type="text" indexed="true" stored="true"/>


p.s. i tried multivalued=true but of no help.

-- 
Thanks,
Pawan Darira

Re: Multiple Values not getting Indexed

Posted by Bill Bell <bi...@gmail.com>.
Is there a way to splitBy and trim the field after splitting?

I know I can do it with Javascript in DIH, but how about using the regex
parser?

On 6/9/11 1:18 AM, "Stefan Matheis" <ma...@googlemail.com> wrote:

>Pawan,
>
>just separating multiple values by comma does not make them
>multi-value in solr-speak. But if you're already using DIH, you may
>try the http://wiki.apache.org/solr/DataImportHandler#RegexTransformer
>to 'splitBy' the field and get the expected field-values
>
>Regards
>Stefan
>
>On Thu, Jun 9, 2011 at 6:14 AM, Pawan Darira <pa...@gmail.com>
>wrote:
>> Hi
>>
>> I am trying to index 2 fields with multiple values. BUT, it is only
>>putting
>> 1 value for each & ignoring rest of the values after comma(,). I am
>>fetching
>> query through DIH. It works fine if i have only 1 value each of the 2
>>fields
>>
>> E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
>> & Field2 - Chandigarh,Gurgaon,New
>> Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others
>>
>> *Schema.xml*
>>
>> <field name="city_type" type="text" indexed="true" stored="true"/>
>> <field name="city_desc" type="text" indexed="true" stored="true"/>
>>
>>
>> p.s. i tried multivalued=true but of no help.
>>
>> --
>> Thanks,
>> Pawan Darira
>>



Re: Multiple Values not getting Indexed

Posted by Stefan Matheis <ma...@googlemail.com>.
Pawan,

just separating multiple values by comma does not make them
multi-value in solr-speak. But if you're already using DIH, you may
try the http://wiki.apache.org/solr/DataImportHandler#RegexTransformer
to 'splitBy' the field and get the expected field-values

Regards
Stefan

On Thu, Jun 9, 2011 at 6:14 AM, Pawan Darira <pa...@gmail.com> wrote:
> Hi
>
> I am trying to index 2 fields with multiple values. BUT, it is only putting
> 1 value for each & ignoring rest of the values after comma(,). I am fetching
> query through DIH. It works fine if i have only 1 value each of the 2 fields
>
> E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
> & Field2 - Chandigarh,Gurgaon,New
> Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others
>
> *Schema.xml*
>
> <field name="city_type" type="text" indexed="true" stored="true"/>
> <field name="city_desc" type="text" indexed="true" stored="true"/>
>
>
> p.s. i tried multivalued=true but of no help.
>
> --
> Thanks,
> Pawan Darira
>

Re: Multiple Values not getting Indexed

Posted by Gora Mohanty <go...@mimirtech.com>.
On Sat, Jun 11, 2011 at 9:52 PM, Pawan Darira <pa...@gmail.com> wrote:
> sorry for the inconvenience. actually i was trying the solution suggested in
> this mail thread. As mentioned in 1st mail,
>
> I am trying to index 2 fields with multiple values. BUT, it is only putting
> 1 value for each & ignoring rest of the values after comma(,). I am fetching
> query through DIH. It works fine if i have only 1 value each of the 2 fields
>
> E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
> & Field2 - Chandigarh,Gurgaon,New
> Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others
>
>
> Schema.xml
>
>
> <field name="city_type" type="text" indexed="true" stored="true"/>
> <field name="city_desc" type="text" indexed="true" stored="true"/>
[...]

You also need to add a multiValued="true" attribute (please note the
case).

> But in my index, it is showing only "150" in Field1 & "Gurgaon" in Field2.
> Then, as suggested in mail thread, i tried to use "split-by ," for field1 &
> field2 in schema.xml. It did not show me the error and results were also the
> same as it was before using "split by". Along with split-by i mentioned the
> attribute as "multivalued=true".
[...]

This is still not making much sense. What do you mean by using "split by"?

Please make your schema.xml, and DIH configuration file available, ideally
by putting them on pastebin.com, and listing the links here (please be careful
to obfuscate sensitive data like username, password, etc., that you might be
using to access the data source).

Regards,
Gora

Re: Multiple Values not getting Indexed

Posted by Pawan Darira <pa...@gmail.com>.
sorry for the inconvenience. actually i was trying the solution suggested in
this mail thread. As mentioned in 1st mail,

I am trying to index 2 fields with multiple values. BUT, it is only putting
1 value for each & ignoring rest of the values after comma(,). I am fetching
query through DIH. It works fine if i have only 1 value each of the 2 fields

E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
& Field2 - Chandigarh,Gurgaon,New
Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others


Schema.xml


<field name="city_type" type="text" indexed="true" stored="true"/>
<field name="city_desc" type="text" indexed="true" stored="true"/>










--------------------------------------------------------------------------------------------------

But in my index, it is showing only "150" in Field1 & "Gurgaon" in Field2.
Then, as suggested in mail thread, i tried to use "split-by ," for field1 &
field2 in schema.xml. It did not show me the error and results were also the
same as it was before using "split by". Along with split-by i mentioned the
attribute as "multivalued=true".






On Fri, Jun 10, 2011 at 10:40 AM, Gora Mohanty <go...@mimirtech.com> wrote:

> On Fri, Jun 10, 2011 at 10:36 AM, Pawan Darira <pa...@gmail.com>
> wrote:
> > it did not work :(
> [...]
>
> Please provide more details of what you tried, what was the error, and
> any error messages that you got. Just saying that "it did not work" makes
> it pretty much impossible for anyone to help you.
>
> You might take a look at http://wiki.apache.org/solr/UsingMailingLists
>
> Regards,
> Gora
>



-- 
Thanks,
Pawan Darira

Re: Multiple Values not getting Indexed

Posted by Gora Mohanty <go...@mimirtech.com>.
On Fri, Jun 10, 2011 at 10:36 AM, Pawan Darira <pa...@gmail.com> wrote:
> it did not work :(
[...]

Please provide more details of what you tried, what was the error, and
any error messages that you got. Just saying that "it did not work" makes
it pretty much impossible for anyone to help you.

You might take a look at http://wiki.apache.org/solr/UsingMailingLists

Regards,
Gora

Re: Multiple Values not getting Indexed

Posted by Pawan Darira <pa...@gmail.com>.
it did not work :(

On Thu, Jun 9, 2011 at 12:53 PM, Bill Bell <bi...@gmail.com> wrote:

> You have to take the input and splitBy something like "," to get it into
> an array and reposted back to
> Solr...
>
> I believe others have suggested that?
>
> On 6/8/11 10:14 PM, "Pawan Darira" <pa...@gmail.com> wrote:
>
> >Hi
> >
> >I am trying to index 2 fields with multiple values. BUT, it is only
> >putting
> >1 value for each & ignoring rest of the values after comma(,). I am
> >fetching
> >query through DIH. It works fine if i have only 1 value each of the 2
> >fields
> >
> >E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
> >& Field2 - Chandigarh,Gurgaon,New
> >Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others
> >
> >*Schema.xml*
> >
> ><field name="city_type" type="text" indexed="true" stored="true"/>
> ><field name="city_desc" type="text" indexed="true" stored="true"/>
> >
> >
> >p.s. i tried multivalued=true but of no help.
> >
> >--
> >Thanks,
> >Pawan Darira
>
>
>


-- 
Thanks,
Pawan Darira

Re: Multiple Values not getting Indexed

Posted by Bill Bell <bi...@gmail.com>.
You have to take the input and splitBy something like "," to get it into
an array and reposted back to
Solr...

I believe others have suggested that?

On 6/8/11 10:14 PM, "Pawan Darira" <pa...@gmail.com> wrote:

>Hi
>
>I am trying to index 2 fields with multiple values. BUT, it is only
>putting
>1 value for each & ignoring rest of the values after comma(,). I am
>fetching
>query through DIH. It works fine if i have only 1 value each of the 2
>fields
>
>E.g. Field1 - 150,178,461,151,310,306,305,179,137,162
>& Field2 - Chandigarh,Gurgaon,New
>Delhi,Ahmedabad,Rajkot,Surat,Mumbai,Nagpur,Pune,India - Others
>
>*Schema.xml*
>
><field name="city_type" type="text" indexed="true" stored="true"/>
><field name="city_desc" type="text" indexed="true" stored="true"/>
>
>
>p.s. i tried multivalued=true but of no help.
>
>-- 
>Thanks,
>Pawan Darira