Re: Question on sorting

2020-07-23 Thread Saurabh Sharma
Hi,
It is because field is string and numbers are getting sorted
lexicographically.It has nothing to do with number of digits.

Thanks
Saurabh


On Thu, Jul 23, 2020, 11:24 AM Srinivas Kashyap
 wrote:

> Hello,
>
> I have schema and field definition as shown below:
>
>  omitNorms="true"/>
>
>
>   />
>
> TRACK_ID field contains "NUMERIC VALUE".
>
> When I use sort on track_id (TRACK_ID desc) it is not working properly.
>
> ->I have below values in Track_ID
>
> Doc1: "84806"
> Doc2: "124561"
>
> Ideally, when I use sort command, query result should be
>
> Doc2: "124561"
> Doc1: "84806"
>
> But I'm getting:
>
> Doc1: "84806"
> Doc2: "124561"
>
> Is this because, field type is string and doc1 has 5 digits and doc2 has 6
> digits?
>
> Please provide solution for this.
>
> Thanks,
> Srinivas
>
>
> 
> DISCLAIMER:
> E-mails and attachments from Bamboo Rose, LLC are confidential.
> If you are not the intended recipient, please notify the sender
> immediately by replying to the e-mail, and then delete it without making
> copies or using it in any way.
> No representation is made that this email or any attachments are free of
> viruses. Virus scanning is recommended and is the responsibility of the
> recipient.
>
> Disclaimer
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it. If you are not the recipient, you are hereby
> notified that any disclosure, copying, distribution or taking action in
> relation of the contents of this information is strictly prohibited and may
> be unlawful.
>
> This email has been scanned for viruses and malware, and may have been
> automatically archived by Mimecast Ltd, an innovator in Software as a
> Service (SaaS) for business. Providing a safer and more useful place for
> your human generated data. Specializing in; Security, archiving and
> compliance. To find out more visit the Mimecast website.
>


Question on sorting

2020-07-22 Thread Srinivas Kashyap
Hello,

I have schema and field definition as shown below:






TRACK_ID field contains "NUMERIC VALUE".

When I use sort on track_id (TRACK_ID desc) it is not working properly.

->I have below values in Track_ID

Doc1: "84806"
Doc2: "124561"

Ideally, when I use sort command, query result should be

Doc2: "124561"
Doc1: "84806"

But I'm getting:

Doc1: "84806"
Doc2: "124561"

Is this because, field type is string and doc1 has 5 digits and doc2 has 6 
digits?

Please provide solution for this.

Thanks,
Srinivas



DISCLAIMER:
E-mails and attachments from Bamboo Rose, LLC are confidential.
If you are not the intended recipient, please notify the sender immediately by 
replying to the e-mail, and then delete it without making copies or using it in 
any way.
No representation is made that this email or any attachments are free of 
viruses. Virus scanning is recommended and is the responsibility of the 
recipient.

Disclaimer

The information contained in this communication from the sender is 
confidential. It is intended solely for use by the recipient and others 
authorized to receive it. If you are not the recipient, you are hereby notified 
that any disclosure, copying, distribution or taking action in relation of the 
contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been 
automatically archived by Mimecast Ltd, an innovator in Software as a Service 
(SaaS) for business. Providing a safer and more useful place for your human 
generated data. Specializing in; Security, archiving and compliance. To find 
out more visit the Mimecast website.


Re: Newbie question on sorting

2012-05-02 Thread Jacek
Erick, I'll do that. Thank you very much.

Regards,
Jacek

On Tue, May 1, 2012 at 7:19 AM, Erick Erickson erickerick...@gmail.comwrote:

 The easiest way is to do that in the app. That is, return the top
 10 to the app (by score) then re-order them there. There's nothing
 in Solr that I know of that does what you want out of the box.

 Best
 Erick

 On Mon, Apr 30, 2012 at 11:10 AM, Jacek pjac...@gmail.com wrote:
  Hello all,
 
  I'm facing this simple problem, yet impossible to resolve for me (I'm a
  newbie in Solr).
  I need to sort the results by score (it is simple, of course), but then
  what I need is to take top 10 results, and re-order it (only those top 10
  results) by a date field.
  It's not the same as sort=score,creationdate
 
  Any suggestions will be greatly appreciated!



Re: Newbie question on sorting

2012-05-01 Thread Erick Erickson
The easiest way is to do that in the app. That is, return the top
10 to the app (by score) then re-order them there. There's nothing
in Solr that I know of that does what you want out of the box.

Best
Erick

On Mon, Apr 30, 2012 at 11:10 AM, Jacek pjac...@gmail.com wrote:
 Hello all,

 I'm facing this simple problem, yet impossible to resolve for me (I'm a
 newbie in Solr).
 I need to sort the results by score (it is simple, of course), but then
 what I need is to take top 10 results, and re-order it (only those top 10
 results) by a date field.
 It's not the same as sort=score,creationdate

 Any suggestions will be greatly appreciated!


Newbie question on sorting

2012-04-30 Thread Jacek
Hello all,

I'm facing this simple problem, yet impossible to resolve for me (I'm a
newbie in Solr).
I need to sort the results by score (it is simple, of course), but then
what I need is to take top 10 results, and re-order it (only those top 10
results) by a date field.
It's not the same as sort=score,creationdate

Any suggestions will be greatly appreciated!


RE: Question about sorting by a field

2012-01-20 Thread federico.wachs
Yes, that works! I had to boost the firstDestination field to have it well
sorted. Any ideas why the score might be equally for all the documents
returned?

Thanks a lot!
Federico

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Question-about-sorting-by-a-field-tp3673491p3676815.html
Sent from the Solr - User mailing list archive at Nabble.com.


Question about sorting by a field

2012-01-19 Thread federico.wachs
Hi all, I've been working with solr for a few months now and so far I only
had a few issues trying to implement some functionality, but this has gone
above my current solr skills, so any help or guidance is greatly
appreciated.

I have a multivalued field consited which contains destinations like:
Paris, Rome, London
doc id=1
destinations
value=quot;Buenos Airesquot;/
value=quot;Parisquot;/
value=quot;Londonquot;/
value=quot;Romequot;/
   /destinations
/doc
doc id=2 
  destinations
value=quot;Londonquot;/
value=quot;Buenos Airesquot;/
value=quot;Parisquot;/
value=quot;Romequot;/
   /destinations
/doc

Ok so those are my documents. Then I query searching documents containing
Buenos Aires as a destination, those two documents will come as results, so
far so good. 
Now, what is really important for me, is that the first results are the ones
that match the first destination, since the user will want to see those
first as well. 

My question is, how can I sort this results ? What should I use? Is there a
way to do this with Solr? 

I've been reading on how to pull this out by using boosts but that doesn't
seem to be working on my end so far.


Thanks in advanced!

Federico

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Question-about-sorting-by-a-field-tp3673491p3673491.html
Sent from the Solr - User mailing list archive at Nabble.com.


RE: Question about sorting by a field

2012-01-19 Thread Michael Ryan
How about having a single-valued field named firstDestination that has the 
first destination in the list, and then your query could be something like 
'destination:Buenos Aires firstDestination:Buenos Aires'. Docs that match 
both should have a higher score and thus will be listed first.

-Michael


Question about sorting by coordination factor

2011-06-02 Thread Jesus Gabriel y Galan

Hi,

I am trying to solve a sorting problem using Solr. The sorting requirements are 
a bit complicated.
I have to sort the documents by three different criteria:

- First by number of keywords that match  (coordination factor)
- Then, within the documents that match the same number of keywords, sort first 
the documents that match a user value (country) and then the rest.
- Then within those two blocks, sort by a document value (popularity).

I have managed to make the second and third criteria to work, with a query like 
this:

http://localhost:8983/solr/select/?q=description%3Afootballversion=2.2start=0rows=10indent=onqq=country_uk:truesort=map%28query%28$qq,-1%29,0,999,1%29%20desc,popularity%20desc

This gets with the query function a positive value for the documents that match 
the country, and a negative for the ones that don't, and then maps those ones 
to 1, so I have two blocks of documents with sorting value of 1 and -1, which 
works for me cause ties are then sorted by popularity.  But as you see, this is 
only searching for 1 keyword.

My problem comes with the first requirement when we search for more than one 
keyword, because as I understand, I would like to sort by the coordination 
factor, which is the number of query keywords that each document matches. The 
problem is that there's no Function Query I can use to get that value, so I 
don't know how to proceed. I was trying to understand if there was a way to 
split the regular score into sets which should mean that the same number of 
keywords was matched, but the score depends on different things, and the range 
of values can be arbitrary, so I'm not able to make such a function.

Is there any solution to this?

Thanks,

Jesus.


Re: Question about sorting by coordination factor

2011-06-02 Thread Erick Erickson
Say you're trying to match terms A, B, C. Would something like

(A AND B AND C)^1000 OR (A AND B)^100 OR (A AND C)^100 OR (B AND
C)^100 OR A OR B OR C

work? It wouldn't be an absolute ordering, but it would tend to
push the documents where all three terms matched toward
the top.

It would get really cumbersome if there were lots of terms, but.

Best
Erick

On Thu, Jun 2, 2011 at 6:21 AM, Jesus Gabriel y Galan
jesus.gabrielyga...@buongiorno.com wrote:
 Hi,

 I am trying to solve a sorting problem using Solr. The sorting requirements
 are a bit complicated.
 I have to sort the documents by three different criteria:

 - First by number of keywords that match  (coordination factor)
 - Then, within the documents that match the same number of keywords, sort
 first the documents that match a user value (country) and then the rest.
 - Then within those two blocks, sort by a document value (popularity).

 I have managed to make the second and third criteria to work, with a query
 like this:

 http://localhost:8983/solr/select/?q=description%3Afootballversion=2.2start=0rows=10indent=onqq=country_uk:truesort=map%28query%28$qq,-1%29,0,999,1%29%20desc,popularity%20desc

 This gets with the query function a positive value for the documents that
 match the country, and a negative for the ones that don't, and then maps
 those ones to 1, so I have two blocks of documents with sorting value of 1
 and -1, which works for me cause ties are then sorted by popularity.  But as
 you see, this is only searching for 1 keyword.

 My problem comes with the first requirement when we search for more than one
 keyword, because as I understand, I would like to sort by the coordination
 factor, which is the number of query keywords that each document matches.
 The problem is that there's no Function Query I can use to get that value,
 so I don't know how to proceed. I was trying to understand if there was a
 way to split the regular score into sets which should mean that the same
 number of keywords was matched, but the score depends on different things,
 and the range of values can be arbitrary, so I'm not able to make such a
 function.

 Is there any solution to this?

 Thanks,

 Jesus.



Re: Question about sorting by coordination factor

2011-06-02 Thread Jesus Gabriel y Galan

On 02/06/11 13:32, Erick Erickson wrote:

Say you're trying to match terms A, B, C. Would something like

(A AND B AND C)^1000 OR (A AND B)^100 OR (A AND C)^100 OR (B AND
C)^100 OR A OR B OR C

work? It wouldn't be an absolute ordering, but it would tend to
push the documents where all three terms matched toward
the top.


The problem with this is that that would give better score to the documents 
with most number of matches, but then I have to sort internally those groups. 
So I'd need a sort=score,xxx,yyy and the score would not be equal for the 
documents which match the same number of keywords.
I would need to have as many groups as keywords, and within each group all 
documents need to have the same value for that sorting criteria (score or a 
function or whatever), so that they tie, and they move to the next sorting 
criteria.

Thanks,

Jesus.


Re: Question about sorting by coordination factor

2011-06-02 Thread Erick Erickson
Ahhh, you're right. I know there's been some discussion in the past about
how to find out the number of terms that matched, but don't remember the
outcome off-hand. You might try searching the mail archive for something like
number of matching terms or some such.

Sorry I'm not more help
Erick

On Thu, Jun 2, 2011 at 8:48 AM, Jesus Gabriel y Galan
jesus.gabrielyga...@buongiorno.com wrote:
 On 02/06/11 13:32, Erick Erickson wrote:

 Say you're trying to match terms A, B, C. Would something like

 (A AND B AND C)^1000 OR (A AND B)^100 OR (A AND C)^100 OR (B AND
 C)^100 OR A OR B OR C

 work? It wouldn't be an absolute ordering, but it would tend to
 push the documents where all three terms matched toward
 the top.

 The problem with this is that that would give better score to the documents
 with most number of matches, but then I have to sort internally those
 groups. So I'd need a sort=score,xxx,yyy and the score would not be equal
 for the documents which match the same number of keywords.
 I would need to have as many groups as keywords, and within each group all
 documents need to have the same value for that sorting criteria (score or a
 function or whatever), so that they tie, and they move to the next sorting
 criteria.

 Thanks,

 Jesus.



Question on sorting

2009-04-22 Thread Mathias Herberts
Hi,

I have a Solr index with an awful lot of tiny documents in it
(hundreds of millions) each having a few fields.

I can query the index without problem and retrieve results sorted on score.

I am now exploring the possibility of sorting on other fields. The
typical number of results from queries is in the 100s or 1000s, so
tiny in regard to index size.

From what I remember of Lucene, it had (still has?) to build a
FieldCache prior to sorting, and this FieldCache contains all field
values for the field to sort on right?

My question is, is there a way around that behaviour of the field
cache, i.e. could a filter query somehow limit the values loaded in
the FieldCache?

Is there otherwise a WTH (Well Known Hack) to be able to sort on
fields when an index has lots (100s of 1000s) of values for that
field?

Any help appreciated,

Mathias.


RE: question about sorting

2007-06-12 Thread Xuesong Luo
Thanks, Yonik. Unfortunately we have users whose first names contain
more than one word, it seems copy field is my only option.

Thanks
Xuesong 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yonik
Seeley
Sent: Tuesday, June 12, 2007 10:35 AM
To: solr-user@lucene.apache.org
Subject: Re: question about sorting

On 6/11/07, Xuesong Luo [EMAIL PROTECTED] wrote:
 For example, first name, department, job title etc.

Something like first name might be able to be a single field that is
searchable and sortable (use a keyword tokenizer followed by a
lowercase filter).  If the field contains multiple words, and you want
to both search and sort on that field, there isn't currently a better
alternative to copyField.

-Yonik




Re: question about sorting

2007-06-12 Thread Yonik Seeley

On 6/12/07, Xuesong Luo [EMAIL PROTECTED] wrote:

Thanks, Yonik. Unfortunately we have users whose first names contain
more than one word, it seems copy field is my only option.


Yes, if you need to be able to match on part of a first name, rather
than just exact first name.

-Yonik


question about sorting

2007-06-11 Thread Xuesong Luo
Hi,
My sorting fields include both TextField type and StrField type. Because
TextField uses TokenizerFactory, they can't be sorted. I have to copy
each TextField to a StrField and sort on those StrFields. Does anyone
know if there is a better way to do that?

Thanks
Xuesong



Re: question about sorting

2007-06-11 Thread Yonik Seeley

On 6/11/07, Xuesong Luo [EMAIL PROTECTED] wrote:

My sorting fields include both TextField type and StrField type. Because
TextField uses TokenizerFactory, they can't be sorted. I have to copy
each TextField to a StrField and sort on those StrFields. Does anyone
know if there is a better way to do that?


What information does this TextField carry?
Sorting works on indexed field values, and thus needs to be
single-valued per document.

-Yonik


RE: question about sorting

2007-06-11 Thread Xuesong Luo
For example, first name, department, job title etc.

Thanks
Xuesong

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yonik
Seeley
Sent: Monday, June 11, 2007 6:35 PM
To: solr-user@lucene.apache.org
Subject: Re: question about sorting

On 6/11/07, Xuesong Luo [EMAIL PROTECTED] wrote:
 My sorting fields include both TextField type and StrField type.
Because
 TextField uses TokenizerFactory, they can't be sorted. I have to copy
 each TextField to a StrField and sort on those StrFields. Does anyone
 know if there is a better way to do that?

What information does this TextField carry?
Sorting works on indexed field values, and thus needs to be
single-valued per document.

-Yonik




question regarding sorting

2007-05-23 Thread James O'Rourke
I am having strange behaviour experimenting with the example solr  
server. Via the tutorial - except I set up my own schema. Anyway,  
here's the issue - if I provide the explicit sort param in my  
request, the sort does not seem to execute, however if I have the  
encoded sort via using ; field desc for example, sorting does work.  
Is this expected behaviour? Is there something I'm missing.


Eg;

This does not sort:

http://localhost:8983/solr/select/?indent=onq=24sort=lastmodified% 
20descfl=uniquekey,lastmodified


This does:

http://localhost:8983/solr/select/?indent=onq=24;%20lastmodified% 
20ascfl=uniquekey,lastmodified


Anyone know why?

James



Re: question regarding sorting

2007-05-23 Thread Nick Jenkin

Hi James
I think this feature is in 1.2, which is not released yet (in CVS/nightly)


From http://wiki.apache.org/solr/StandardRequestHandler

Note, in solr1.1 the query and sort parameter were combined as a
single parameter separated with a ';' (q=name:solr; date desc).
Since solr1.2, it is recommend to use the sort parameter described
in CommonQueryParameters.
-Nick


On 5/24/07, James O'Rourke [EMAIL PROTECTED] wrote:

I am having strange behaviour experimenting with the example solr
server. Via the tutorial - except I set up my own schema. Anyway,
here's the issue - if I provide the explicit sort param in my
request, the sort does not seem to execute, however if I have the
encoded sort via using ; field desc for example, sorting does work.
Is this expected behaviour? Is there something I'm missing.

Eg;

This does not sort:

http://localhost:8983/solr/select/?indent=onq=24sort=lastmodified%
20descfl=uniquekey,lastmodified

This does:

http://localhost:8983/solr/select/?indent=onq=24;%20lastmodified%
20ascfl=uniquekey,lastmodified

Anyone know why?

James