Re: Concat Fields in JSON Facet

2017-01-17 Thread Zheng Lin Edwin Yeo
Hi Evans,

Thanks for your reply.

I would like to show both the ItemId and the ItemName together in the same
JSON output bucket.
Currently I'm only able to show one of them in one bucket. If I want to
show both, it will be show in 2 buckets, like the one below, which will
probably cause the output to double in size.

   "facets":{
"count":1,
"itemNo":{
  "buckets":[{
  "val":"",
  "count":3591}]},
"itemName":{
  "buckets":[{
  "val":"item",
  "count":3591}]}

I'm using Solr 6.2.1.

Regards,
Edwin


On 18 January 2017 at 00:15, Tom Evans  wrote:

> On Mon, Jan 16, 2017 at 2:58 PM, Zheng Lin Edwin Yeo
>  wrote:
> > Hi,
> >
> > I have been using JSON Facet, but I am facing some constraints in
> > displaying the field.
> >
> > For example, I have 2 fields, itemId and itemName. However, when I do the
> > JSON Facet, I can only get it to show one of them in the output, and I
> > could not get it to show both together.
> > I will like to show both the ID and Name together, so that it will be
> more
> > meaningful and easier for user to understand, without having to refer to
> > another table to determine the match between the ID and Name.
>
> I don't understand what you mean. If you have these three documents in
> your index, what data do you want in the facet?
>
> [
>   {itemId: 1, itemName: "Apple"},
>   {itemId: 2, itemName: "Android"},
>   {itemId: 3, itemName: "Android"},
> ]
>
> Cheers
>
> Tom
>


Re: Concat Fields in JSON Facet

2017-01-17 Thread Tom Evans
On Mon, Jan 16, 2017 at 2:58 PM, Zheng Lin Edwin Yeo
 wrote:
> Hi,
>
> I have been using JSON Facet, but I am facing some constraints in
> displaying the field.
>
> For example, I have 2 fields, itemId and itemName. However, when I do the
> JSON Facet, I can only get it to show one of them in the output, and I
> could not get it to show both together.
> I will like to show both the ID and Name together, so that it will be more
> meaningful and easier for user to understand, without having to refer to
> another table to determine the match between the ID and Name.

I don't understand what you mean. If you have these three documents in
your index, what data do you want in the facet?

[
  {itemId: 1, itemName: "Apple"},
  {itemId: 2, itemName: "Android"},
  {itemId: 3, itemName: "Android"},
]

Cheers

Tom


Re: Concat Fields in JSON Facet

2017-01-16 Thread Zheng Lin Edwin Yeo
Hi,

So is there anyway which we can concat 2 fields together in JSON Facet?

Regards,
Edwin


On 16 January 2017 at 22:58, Zheng Lin Edwin Yeo 
wrote:

> Hi,
>
> I have been using JSON Facet, but I am facing some constraints in
> displaying the field.
>
> For example, I have 2 fields, itemId and itemName. However, when I do the
> JSON Facet, I can only get it to show one of them in the output, and I
> could not get it to show both together.
> I will like to show both the ID and Name together, so that it will be more
> meaningful and easier for user to understand, without having to refer to
> another table to determine the match between the ID and Name.
>
> I have tried to do something like the below, but it will only show the 2nd
> field.
>
> http://localhost:8983/solr/collection/select?q=*:*&json.facet={
>item:{
>  type:terms,
>  field:itemId,
>  field:itemName,
>  limit:200
> }
> }
>
> If I do the following, I'll get error.
>
> http://localhost:8983/solr/collection/select?q=*:*&json.facet={
>item:{
>  type:terms,
>  field:itemId;itemName,
>  limit:200
> }
> }
>
>
> This will probably work, but it will greatly increase the size of the
> output, as 2 buckets will be produced.
>
> http://localhost:8983/solr/collection/select?q=*:*&json.facet={
> itemId:{
>  type:terms,
>  field:itemId,
>  limit:200
> },
> itemName:{
>  type:terms,
>  field:itemName,
>  limit:200
> }
> }
>
>
> Is there any way which I can do to concat both the itemId and the itemName
> into a single JSON together?
>
> Regards,
> Edwin
>
>


Concat Fields in JSON Facet

2017-01-16 Thread Zheng Lin Edwin Yeo
Hi,

I have been using JSON Facet, but I am facing some constraints in
displaying the field.

For example, I have 2 fields, itemId and itemName. However, when I do the
JSON Facet, I can only get it to show one of them in the output, and I
could not get it to show both together.
I will like to show both the ID and Name together, so that it will be more
meaningful and easier for user to understand, without having to refer to
another table to determine the match between the ID and Name.

I have tried to do something like the below, but it will only show the 2nd
field.

http://localhost:8983/solr/collection/select?q=*:*&json.facet={
   item:{
 type:terms,
 field:itemId,
 field:itemName,
 limit:200
}
}

If I do the following, I'll get error.

http://localhost:8983/solr/collection/select?q=*:*&json.facet={
   item:{
 type:terms,
 field:itemId;itemName,
 limit:200
}
}


This will probably work, but it will greatly increase the size of the
output, as 2 buckets will be produced.

http://localhost:8983/solr/collection/select?q=*:*&json.facet={
itemId:{
 type:terms,
 field:itemId,
 limit:200
},
itemName:{
 type:terms,
 field:itemName,
 limit:200
}
}


Is there any way which I can do to concat both the itemId and the itemName
into a single JSON together?

Regards,
Edwin