bug in SolrInputDocument.toString()?

2019-06-25 Thread Mark Sholund
Hello,
First time poster here so sorry for any formatting problems.  I am sorry if 
this has been asked before but I've tried several version of SolrJ 
(6.5.1-8.1.1) with the same result.

I am runing the following example code and am seeing odd output.

String id = "foo123";
int popularity=1;
SolrInputDocument inputDocument = new SolrInputDocument();
System.out.println("creating document for " + id);
inputDocument.addField(ID_FIELD, id);
inputDocument.addField(POPULARITY_FIELD, Collections.singletonMap("set", 
popularity));
// System.out.println("document: " + inputDocument);
System.out.println("json: " + inputDocument.jsonStr());

This produces the output

creating document for foo123
document: {id=id=foo123, popularity_i=popularity_i={set=1}}
json: {"id":"id=foo123","popularity_i":"popularity_i={set=1}"}

I cannot see anything that I am doing wrong and the update succeeds.  Is this 
just a bug in the toString() and jsonStr() methods?

publickey - mark.d.sholund@protonmail.com - 0x9EF69757.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature


Re: SolrInputDocument setField method

2019-06-26 Thread Mark Sholund
I noticed this yesterday as well. The toString() and jsonStr() (in later 
versions) of SolrJ both include things like

toString(): 
{id=id=[foo123](https://www.nga.mil/careers/studentopp/Pages/default.aspx), ...}
or
jsonStr(): 
{"id":"id=[foo123](https://www.nga.mil/careers/studentopp/Pages/default.aspx)",...}

However Solr does not reject the documents so this must just be an issue with 
the two methods.

On Wed, Jun 26, 2019 at 12:31 PM, Samuel Kasimalla  wrote:

> Hi Vicenzo,
>
> May be looking at the overridden toString() would give you a clue.
>
> The second part, I don't think SolrJ holds it it twice(if you are worried
> about redundant usage of memory), BUT if you haven't used SolrJ so far and
> wanted to know if this is the format in which it pushes to Solr, I'm pretty
> sure it doesn't push this format into Solr.
>
> Thanks,
> Sam
> https://www.linkedin.com/in/skasimalla
>
> On Wed, Jun 26, 2019 at 11:52 AM Vincenzo D'Amore 
> wrote:
>
>> Hi all,
>>
>> I have a very basic question related to the SolrInputDocument behaviour.
>>
>> Looking at SolrInputDocument source code I found how the method setField
>> works:
>>
>> public void setField(String name, Object value )
>> {
>> SolrInputField field = new SolrInputField( name );
>> _fields.put( name, field );
>> field.setValue( value );
>> }
>>
>> The field name is "duplicated" into the SolrInputField.
>>
>> For example, if I'm storing a field "color" with value "red" what we have
>> is a Map like this:
>>
>> { "key" : "color", "value" : { "name" : "color", "value" : "red" } }
>>
>> the name field "color" appears twice. Very likely there is a reason for
>> this, could you please point me in the right direction?
>>
>> For example, I'm worried about at what happens with SolrJ when I'm sending
>> a lot of documents, where for each field the fieldName is sent twice.
>>
>> Thanks,
>> Vincenzo
>>
>>
>> --
>> Vincenzo D'Amore
>>-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-

qf in conjunction with boost

2019-06-27 Thread Mark Sholund
Hello,

I have been using the following to boost based on field content.

qf=title^5 description^5 _text_

And now I want to include additional boosting based on a popularity score 
include with some documents. I’ve done this as follows

q={!boost b=map(popularity_d,0,0,1)}

However now it seems that the score is the same regardless of whether qf is 
included or not - this renders qf irrelevant to my query.

Can I do both of these boostings?  A multiplicative boost on the fields is 
acceptable if that’s possible and simplifies an answer.

- Mark-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-

Re: qf in conjunction with boost

2019-06-29 Thread Mark Sholund
No responses yet, is my question unclear or is this not possible?

On Thu, Jun 27, 2019 at 10:54 PM, Mark Sholund  
wrote:

> Hello,
>
> I have been using the following to boost based on field content.
>
> qf=title^5 description^5 _text_
>
> And now I want to include additional boosting based on a popularity score 
> include with some documents. I’ve done this as follows
>
> q={!boost b=map(popularity_d,0,0,1)}
>
> However now it seems that the score is the same regardless of whether qf is 
> included or not - this renders qf irrelevant to my query.
>
> Can I do both of these boostings?  A multiplicative boost on the fields is 
> acceptable if that’s possible and simplifies an answer.
>
> - Mark-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-

Re: qf in conjunction with boost

2019-06-29 Thread Mark Sholund
Thanks for you reply.

The problem I ran into with using the boost parameter was that not all of my 
documents have the boosting field and those were coming back with a score of 
zero.  I tried setting a default for that field but it didn’t help. I found 
somewhere that using the boost parser with a map function would get me around 
that and it seemed to until I noticed that the qf parameter was being ignored. 
Maybe I can use bf instead.

Sent from ProtonMail Mobile

On Sat, Jun 29, 2019 at 8:56 PM, Shawn Heisey  wrote:

> On 6/27/2019 8:54 PM, Mark Sholund wrote:
>> qf=title^5 description^5 _text_
>>
>> And now I want to include additional boosting based on a popularity
>> score include with some documents. I’ve done this as follows
>>
>> q={!boost b=map(popularity_d,0,0,1)}
>>
>> However now it seems that the score is the same regardless of whether qf
>> is included or not - this renders qf irrelevant to my query.
>
> qf is a parameter for the dismax and edismax query parsers, but your
> query has changed to the boost query parser. It is very unlikely that
> the boost parser uses the qf parameter.
>
> It looks like using edismax with its "boost" parameter MIGHT be what you
> are after:
>
> https://lucene.apache.org/solr/guide/8_1/the-extended-dismax-query-parser.html
>
> The edismax parser also supports the bq and bf parameters from the
> dismax parser:
>
> https://lucene.apache.org/solr/guide/8_1/the-dismax-query-parser.html#bq-boost-query-parameter
>
> Thanks,
> Shawn-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-

Re: qf in conjunction with boost

2019-06-29 Thread Mark Sholund
On further reading it seems that maybe

&boost=map(popularity_d,0,0,1) might work

On Sat, Jun 29, 2019 at 8:56 PM, Shawn Heisey  wrote:

> On 6/27/2019 8:54 PM, Mark Sholund wrote:
>> qf=title^5 description^5 _text_
>>
>> And now I want to include additional boosting based on a popularity
>> score include with some documents. I’ve done this as follows
>>
>> q={!boost b=map(popularity_d,0,0,1)}
>>
>> However now it seems that the score is the same regardless of whether qf
>> is included or not - this renders qf irrelevant to my query.
>
> qf is a parameter for the dismax and edismax query parsers, but your
> query has changed to the boost query parser. It is very unlikely that
> the boost parser uses the qf parameter.
>
> It looks like using edismax with its "boost" parameter MIGHT be what you
> are after:
>
> https://lucene.apache.org/solr/guide/8_1/the-extended-dismax-query-parser.html
>
> The edismax parser also supports the bq and bf parameters from the
> dismax parser:
>
> https://lucene.apache.org/solr/guide/8_1/the-dismax-query-parser.html#bq-boost-query-parameter
>
> Thanks,
> Shawn-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-

Re: Sort on PointFieldType

2019-07-03 Thread Mark Sholund
My thought is that “greater than” and “less than” are generally undefined for 
n-dimensional points where n>1.
Is (45,45) > (-45,-45)?  If you’re talking about distance from (0,0) they’re 
“equal”. If you’re talking about distance from some arbitrary point then they 
are not necessarily “equal”; what would make one sort higher/lower?

On Wed, Jul 3, 2019 at 2:50 PM, Prince Manohar  
wrote:

> Hi,
> I have a *field* that is of *PointType *and I tried to sort on that field.
> But looks like sorting does not work on PointType.
> Or am I doing something wrong?
> Find my query below:-
> http://localhost:8983/solr/testcollection/select?indent=on&q=*:*&sort=abc.pqr_d
> DESC&wt=json
> 
>
> --
> *Regards,
> *
> *Prince Manohar
> *
> *B.Tech (InformationTechnology)
> *
> *Bengaluru
> *
> *+91 7797045315
> *-BEGIN PGP PUBLIC KEY BLOCK-
Version: Pmcrypto Golang 0.0.1 (ddacebe0)
Comment: https://protonmail.com

xjMEXMJGxxYJKwYBBAHaRw8BAQdAbwlnObuOIUWLq2qqb+MFiIqxKvGaHeKEk/k/
7Eh5SUjNPyJtYXJrLmQuc2hvbHVuZEBwcm90b25tYWlsLmNvbSIgPG1hcmsuZC5z
aG9sdW5kQHByb3Rvbm1haWwuY29tPsJ3BBAWCgAfBQJcwkbHBgsJBwgDAgQVCAoC
AxYCAQIZAQIbAwIeAQAKCRB2Mb5icFoL0j/8AP9tDyF3ziA4+0zM93ZTD8FuffX0
6mAIbnW/EmXujHZLDQEA3ALWhh1hjlQpm2ruuF1+dlsngebhd1AO93xMsYhGkwPO
OARcwkbHEgorBgEEAZdVAQUBAQdAoA4U5UGvfPMnqvmLKkRdcvyL5tgFAkoSqSnJ
QWFauykDAQgHwmEEGBYIAAkFAlzCRscCGwwACgkQdjG+YnBaC9K9XwD+NyBcSQqc
pUop1n12B+VA/ZKRMNiz8LQusBUEEr9XAr4A/im3m0KIJGHSwgBTNzSuZreg5n6U
DLlTkt3B58b1z3wP
=BNNh
-END PGP PUBLIC KEY BLOCK-