Re: Solr query help
You can add a ~3 to the query to allow the order to be reversed, but you will get extra hits. Maybe it is a ~4, i can never remember on phrases and reversals. I usually just try it. Alternatively, you can create a custom query field for what you need from dates. For example, if you want to search by queries like "fourth tuesday", you need to have 'tuesday" in a query and better to have " 4 tuesday " as part of the field. Instead of a phrase query, you do +2017 +(04 03) +(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31), which does all the days in march and apr. A more complicated nested query would do more complicated date ranges. I don't know if there is a way to get repeating date range queries, like the fourth tuesday for all months in a year. The date support is usually about querying a specified range at a time. tim On Fri, Aug 18, 2017 at 11:19 AM, Webster Homerwrote: > What field types are you using for your dates? > Have a look at: > https://cwiki.apache.org/confluence/display/solr/Working+with+Dates > > On Thu, Aug 17, 2017 at 10:08 AM, Nawab Zada Asad Iqbal > wrote: > > > Hi Krishna > > > > I haven't used date range queries myself. But if Solr only supports a > > particular date format, you can write a thin client for queries, which > will > > convert the date to solr's format and query solr. > > > > Nawab > > > > On Thu, Aug 17, 2017 at 7:36 AM, chiru s wrote: > > > > > Hello guys > > > > > > I am working on Apache solr and I am stuck with a use case. > > > > > > > > > The input data will be in the documents like 2017/03/15 in 1st > document, > > > > > > 2017/04/15 in 2nd doc, > > > > > > 2017/05/15 in 3rd doc, > > > > > > 2017/06/15 in 4th doc so on > > > > > > But while fetching the data it should fetch like 03/15/2017 for the > first > > > doc and so on. > > > > > > My requirement is like this .. > > > > > > > > > The data is like above and when I do an fq with name:[2017/03/15 TO > > > 2017/05/15] it fetches me the 1st three documents.. but the need the > data > > > as 03/15/2017 instead of 2017/03/15. > > > > > > > > > I tried solr.pattetnReplaceCharFilterFactory but it doesn't seem > > working.. > > > > > > Can you please help on the above. > > > > > > > > > Thanks in advance > > > > > > > > > Krishna... > > > > > > > -- > > > This message and any attachment are confidential and may be privileged or > otherwise protected from disclosure. If you are not the intended recipient, > you must not copy this message or attachment or disclose the contents to > any other person. If you have received this transmission in error, please > notify the sender immediately and delete the message and any attachment > from your system. Merck KGaA, Darmstadt, Germany and any of its > subsidiaries do not accept liability for any omissions or errors in this > message which may arise as a result of E-Mail-transmission or for damages > resulting from any unauthorized changes of the content of this message and > any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its > subsidiaries do not guarantee that this message is free of viruses and does > not accept liability for any damages caused by any virus transmitted > therewith. > > Click http://www.emdgroup.com/disclaimer to access the German, French, > Spanish and Portuguese versions of this disclaimer. >
Re: Solr query help
What field types are you using for your dates? Have a look at: https://cwiki.apache.org/confluence/display/solr/Working+with+Dates On Thu, Aug 17, 2017 at 10:08 AM, Nawab Zada Asad Iqbalwrote: > Hi Krishna > > I haven't used date range queries myself. But if Solr only supports a > particular date format, you can write a thin client for queries, which will > convert the date to solr's format and query solr. > > Nawab > > On Thu, Aug 17, 2017 at 7:36 AM, chiru s wrote: > > > Hello guys > > > > I am working on Apache solr and I am stuck with a use case. > > > > > > The input data will be in the documents like 2017/03/15 in 1st document, > > > > 2017/04/15 in 2nd doc, > > > > 2017/05/15 in 3rd doc, > > > > 2017/06/15 in 4th doc so on > > > > But while fetching the data it should fetch like 03/15/2017 for the first > > doc and so on. > > > > My requirement is like this .. > > > > > > The data is like above and when I do an fq with name:[2017/03/15 TO > > 2017/05/15] it fetches me the 1st three documents.. but the need the data > > as 03/15/2017 instead of 2017/03/15. > > > > > > I tried solr.pattetnReplaceCharFilterFactory but it doesn't seem > working.. > > > > Can you please help on the above. > > > > > > Thanks in advance > > > > > > Krishna... > > > -- This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, you must not copy this message or attachment or disclose the contents to any other person. If you have received this transmission in error, please notify the sender immediately and delete the message and any attachment from your system. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not accept liability for any omissions or errors in this message which may arise as a result of E-Mail-transmission or for damages resulting from any unauthorized changes of the content of this message and any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not guarantee that this message is free of viruses and does not accept liability for any damages caused by any virus transmitted therewith. Click http://www.emdgroup.com/disclaimer to access the German, French, Spanish and Portuguese versions of this disclaimer.
Re: Solr query help
Hi Krishna I haven't used date range queries myself. But if Solr only supports a particular date format, you can write a thin client for queries, which will convert the date to solr's format and query solr. Nawab On Thu, Aug 17, 2017 at 7:36 AM, chiru swrote: > Hello guys > > I am working on Apache solr and I am stuck with a use case. > > > The input data will be in the documents like 2017/03/15 in 1st document, > > 2017/04/15 in 2nd doc, > > 2017/05/15 in 3rd doc, > > 2017/06/15 in 4th doc so on > > But while fetching the data it should fetch like 03/15/2017 for the first > doc and so on. > > My requirement is like this .. > > > The data is like above and when I do an fq with name:[2017/03/15 TO > 2017/05/15] it fetches me the 1st three documents.. but the need the data > as 03/15/2017 instead of 2017/03/15. > > > I tried solr.pattetnReplaceCharFilterFactory but it doesn't seem working.. > > Can you please help on the above. > > > Thanks in advance > > > Krishna... >
Solr query help
Hello guys I am working on Apache solr and I am stuck with a use case. The input data will be in the documents like 2017/03/15 in 1st document, 2017/04/15 in 2nd doc, 2017/05/15 in 3rd doc, 2017/06/15 in 4th doc so on But while fetching the data it should fetch like 03/15/2017 for the first doc and so on. My requirement is like this .. The data is like above and when I do an fq with name:[2017/03/15 TO 2017/05/15] it fetches me the 1st three documents.. but the need the data as 03/15/2017 instead of 2017/03/15. I tried solr.pattetnReplaceCharFilterFactory but it doesn't seem working.. Can you please help on the above. Thanks in advance Krishna...
Re: solr query help
On 2/2/2017 6:16 AM, deepak.gha...@mediawide.com wrote: > I am writting query for getting response from specific index content first. > eg. > http://192.168.200.14:8983/solr/mypgmee/select?q=*blood*=id:(*/939/* OR > **)=id=json=true > > In above query I am getting response, Means suppose I Get 4 result for course > "939" out of 10. It works fine by releanvence. > But Now I want "939" course result first then other result.So Please let me > how can I do that. Are those asterisks in your actual query, or did you add some of them for emphasis? I'm guessing that at least some of them are added for emphasis. Asterisks in a query are wildcard characters, and wildcard queries frequently do not behave like people expect them to. We need to see the actual query, without any extra characters. If asterisks have been added, then we will have an incorrect understanding about what the query says. Attempting to guess what you are actually doing, here is what I THINK you might have meant: q=blood fq=id:(939 OR *) If I'm right about that filter query, I do not know what you were trying to do. If you were trying to query for 939 or any other value, use this instead: fq=id:[* TO *] This is a range query that will match all documents where the id field contains SOMETHING. Documents where it is not present will not be matched. If you do not actually want to *filter* on the id value, then you can simply remove the fq parameter entirely. Filter queries do not contribute to scoring at all -- they *only* filter. The last part of your message says you want documents with an id of 939 to be listed first. I think you can do that with this: bq=id:939^10 The bq parameter means "boost query". The ^10 part of what I've written is the boost value. Thanks, Shawn
solr query help
Hello Sir, I am writting query for getting response from specific index content first. eg. http://192.168.200.14:8983/solr/mypgmee/select?q=*blood*=id:(*/939/* OR **)=id=json=true In above query I am getting response, Means suppose I Get 4 result for course "939" out of 10. It works fine by releanvence. But Now I want "939" course result first then other result.So Please let me how can I do that. Thanks & Regards, Deepak G.
Re: Need solr query help
Is it possible instead to store in your solr index a bounding box of store location + delivery radius, do a bounding box intersection between your user's point + radius (as a bounding box) and the shop's delivery bounding box. If you want further precision, the frange may work assuming it's a post-filter implementation so that you are doing heavy computation on a presumably small set of data only to filter out the corner cases around the radius circle that results. I haven't looked at Solr's spatial querying in a while to know if this is possible or not. Cheers Amit On Sat, May 11, 2013 at 10:42 AM, smsolr sms...@hotmail.com wrote: Hi Abhishek, I forgot to explain why it works. It uses the frange filter which is mentioned here:- http://wiki.apache.org/solr/CommonQueryParameters and it works because it filters in results where the geodist minus the shopMaxDeliveryDistance is less than zero (that's what the u=0 means, upper limit=0), i.e.:- geodist - shopMaxDeliveryDistance 0 - geodist shopMaxDeliveryDistance i.e. the geodist is less than the shopMaxDeliveryDistance and so the shop is within delivery range of the location specified. smsolr -- View this message in context: http://lucene.472066.n3.nabble.com/Need-solr-query-help-tp4061800p4062603.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Need solr query help
Hi Abhishek, I've had a look into this problem and have come up with a solution. Following instructions assume you have downloaded the 4.3.0 release of Solr from:- http://www.apache.org/dyn/closer.cgi/lucene/solr/4.3.0 First add to:- solr-4.3.0/solr/example/solr/collection1/conf/schema.xml the following:- field name=shopLocation type=location indexed=true stored=true/ field name=shopMaxDeliveryDistance type=float indexed=true stored=true/ after the id field:- field name=id type=string indexed=true stored=true required=true multiValued=false / Then start solr by going to:- solr-4.3.0/solr/example and running:- java -jar start.jar Then change into your solr-4.3.0/solr/example/exampledocs directory and write the following text to a new file called shops.xml:- add doc field name=id2468/field field name=nameShop A/field field name=shopLocation0.1,0.1/field field name=shopMaxDeliveryDistance10/field /doc doc field name=id2469/field field name=nameShop B/field field name=shopLocation0.2,0.2/field field name=shopMaxDeliveryDistance35/field /doc doc field name=id2470/field field name=nameShop C/field field name=shopLocation0.9,0.1/field field name=shopMaxDeliveryDistance25/field /doc doc field name=id2480/field field name=nameShop D/field field name=shopLocation0.3,0.2/field field name=shopMaxDeliveryDistance50/field /doc /add Now run:- ./post.sh shops.xml You should get back something like:- Posting file shops.xml to http://localhost:8983/solr/update ?xml version=1.0 encoding=UTF-8? response lst name=responseHeaderint name=status0/intint name=QTime120/int/lst /response ?xml version=1.0 encoding=UTF-8? response lst name=responseHeaderint name=status0/intint name=QTime46/int/lst /response The doing the following queries in your browser:- All 4 shops:- http://localhost:8983/solr/select?q=name:shopfl=name,shopLocation,shopMaxDeliveryDistance All shops with distance from point 0.0,0.0 and ordered by distance from point 0.0,0.0 (gives order A, B, D, C):- http://localhost:8983/solr/select?q=name:shopfl=name,shopLocation,shopMaxDeliveryDistance,geodist%28shopLocation,0.0,0.0%29sort=geodist%28shopLocation,0.0,0.0%29%20asc All shops with distance from point 0.0,0.0 and ordered by distance from point 0.0,0.0 and filtered to eliminate all shops with distance from point 0.0,0.0 greater than shopMaxDeliveryDistance (gives shops B and D):- http://localhost:8983/solr/select?q=name:shopfl=name,shopLocation,shopMaxDeliveryDistance,geodist%28shopLocation,0.0,0.0%29sort=geodist%28shopLocation,0.0,0.0%29%20ascfq={!frange%20u=0}sub%28geodist%28shopLocation,0.0,0.0%29,shopMaxDeliveryDistance%29 To delete all shops so you can edit the file to play with it and repost the shops:- http://localhost:8983/solr/update?stream.body=deletequeryname:shop/query/deletecommit=true smsolr -- View this message in context: http://lucene.472066.n3.nabble.com/Need-solr-query-help-tp4061800p4062591.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Need solr query help
Hi Abhishek, I forgot to explain why it works. It uses the frange filter which is mentioned here:- http://wiki.apache.org/solr/CommonQueryParameters and it works because it filters in results where the geodist minus the shopMaxDeliveryDistance is less than zero (that's what the u=0 means, upper limit=0), i.e.:- geodist - shopMaxDeliveryDistance 0 - geodist shopMaxDeliveryDistance i.e. the geodist is less than the shopMaxDeliveryDistance and so the shop is within delivery range of the location specified. smsolr -- View this message in context: http://lucene.472066.n3.nabble.com/Need-solr-query-help-tp4061800p4062603.html Sent from the Solr - User mailing list archive at Nabble.com.
Need solr query help
We are doing spatial search. with following logic. a) There are shops in a city . Each provides the facility of home delivery b) each shop has different max_delivery_distance . Now my query is suppose some one is searching from point P1 with radius R. User wants the result of shops those can deliver him.(distance between P1 to shop s1 say d1 should be less than max_delivery distance say md1 ) how can i implement this by solr spatial query.
About Solr Query help
Hello, Greetings ! I am working on one project which is used solr search facilities and its is good for searching and indexing it. I have one query regarding searching facets, so please guide me. I search color just for example : *attr_color_sm:blue* which i send in query but now I want put * (AND) and || (OR)* condition in that query but I am not able to do this. In that query I want pass another color like Red with both condition so please guide me for that. Waiting for your reply. Thanks in advance. Warm regards, -- *Himanshu Tatariya* Software Engineer, Elan Technologies, Software Development | IT Consulting *ISO 9001:2008 Certified *| http://www.elantechnologies.com http://www.elantechnologies.com/ Disclaimer: Information transmitted/written in this e-mail is proprietary to elan emerging technologies pvt ltd and is intended for exclusive use by the individual or entity to which it is addressed by the sender (subject to his duties/delegation power) and may contain information that is privileged, confidential or exempt from disclosure under applicable law and shall not attach any liability on the originator. Any use, distribution, transmission, forwarding, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. All dispute if any are subject to the jurisdiction at the place where our company's registered office exists. If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately. No responsibility whatsoever it may be for loss or damage arising from the use of the information transmitted by this email including damage from virus on elan emerging technologies pvt ltd.
Re: About Solr Query help
--- On Thu, 11/25/10, Himanshu Tatariya himansh...@elantechnologies.com wrote: From: Himanshu Tatariya himansh...@elantechnologies.com Subject: About Solr Query help To: solr-user@lucene.apache.org Date: Thursday, November 25, 2010, 4:02 PM Hello, Greetings ! I am working on one project which is used solr search facilities and its is good for searching and indexing it. I have one query regarding searching facets, so please guide me. I search color just for example : *attr_color_sm:blue* which i send in query but now I want put * (AND) and || (OR)* condition in that query but I am not able to do this. In that query I want pass another color like Red with both condition so please guide me for that. What is not working? Did you try this attr_color_sm:(blue || red) ?
Re: solr query help alpha numeric and not
Hi yes its a string, in the case of a title, it can be anything, a letter a number, a symbol or a multibyte char etc. Any ideas if I wanted a query that was not a letter a-z or a number 0-9, given that its a string? thanks Joel On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote: Hi Joel, The ID is sent back as a string (instead of as an integer) in your example. Could this be the cause? - Jonathan On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote: Hi, I have a field called firstLetterTitle, this field has 1 char, it can be anything, I need help with a few queries on this char: 1.) I want all NON ALPHA and NON numbers, so any char that is not A- Z or 0-9 I tried: http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z But I get back numeric results: doc str name=firstLetterTitle9/str str name=id23946447/str /doc 2.) I want all only Numerics: http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209 This seems to work but just checking if its the right way. 2.) I want all only English Letters: http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z This seems to work but just checking if its the right way. thanks Joel
Re: solr query help alpha numeric and not
Didn't the queries in my reply work? Cheers Avlesh On Fri, Nov 6, 2009 at 4:16 AM, Joel Nylund jnyl...@yahoo.com wrote: Hi yes its a string, in the case of a title, it can be anything, a letter a number, a symbol or a multibyte char etc. Any ideas if I wanted a query that was not a letter a-z or a number 0-9, given that its a string? thanks Joel On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote: Hi Joel, The ID is sent back as a string (instead of as an integer) in your example. Could this be the cause? - Jonathan On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote: Hi, I have a field called firstLetterTitle, this field has 1 char, it can be anything, I need help with a few queries on this char: 1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or 0-9 I tried: http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z But I get back numeric results: doc str name=firstLetterTitle9/str str name=id23946447/str /doc 2.) I want all only Numerics: http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209 This seems to work but just checking if its the right way. 2.) I want all only English Letters: http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z This seems to work but just checking if its the right way. thanks Joel
Re: solr query help alpha numeric and not
Avlesh, thanks those worked, for somre reason I never got your mail, found it in one of the list archives though. thanks again Joel On Nov 5, 2009, at 9:08 PM, Avlesh Singh wrote: Didn't the queries in my reply work? Cheers Avlesh On Fri, Nov 6, 2009 at 4:16 AM, Joel Nylund jnyl...@yahoo.com wrote: Hi yes its a string, in the case of a title, it can be anything, a letter a number, a symbol or a multibyte char etc. Any ideas if I wanted a query that was not a letter a-z or a number 0-9, given that its a string? thanks Joel On Nov 4, 2009, at 9:10 AM, Jonathan Hendler wrote: Hi Joel, The ID is sent back as a string (instead of as an integer) in your example. Could this be the cause? - Jonathan On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote: Hi, I have a field called firstLetterTitle, this field has 1 char, it can be anything, I need help with a few queries on this char: 1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or 0-9 I tried: http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z But I get back numeric results: doc str name=firstLetterTitle9/str str name=id23946447/str /doc 2.) I want all only Numerics: http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209 This seems to work but just checking if its the right way. 2.) I want all only English Letters: http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z This seems to work but just checking if its the right way. thanks Joel
solr query help alpha numeric and not
Hi, I have a field called firstLetterTitle, this field has 1 char, it can be anything, I need help with a few queries on this char: 1.) I want all NON ALPHA and NON numbers, so any char that is not A-Z or 0-9 I tried: http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z But I get back numeric results: doc str name=firstLetterTitle9/str str name=id23946447/str /doc 2.) I want all only Numerics: http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209 This seems to work but just checking if its the right way. 2.) I want all only English Letters: http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z This seems to work but just checking if its the right way. thanks Joel
Re: solr query help alpha numeric and not
Hi Joel, The ID is sent back as a string (instead of as an integer) in your example. Could this be the cause? - Jonathan On Nov 4, 2009, at 9:08 AM, Joel Nylund wrote: Hi, I have a field called firstLetterTitle, this field has 1 char, it can be anything, I need help with a few queries on this char: 1.) I want all NON ALPHA and NON numbers, so any char that is not A- Z or 0-9 I tried: http://localhost:8983/solr/select?q=NOT%20firstLetterTitle:0%20TO%209%20AND%20NOT%20firstLetterTitle:A%20TO%20Z But I get back numeric results: doc str name=firstLetterTitle9/str str name=id23946447/str /doc 2.) I want all only Numerics: http://localhost:8983/solr/select?q=firstLetterTitle:0%20TO%209 This seems to work but just checking if its the right way. 2.) I want all only English Letters: http://localhost:8983/solr/select?q=firstLetterTitle:A%20TO%20Z This seems to work but just checking if its the right way. thanks Joel
Re: Solr Query help - sorting
make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.comwrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
You couldn't sort on a multiValued field though. I'd simply index a max_side field, and have the indexing client add a single valued field with max(length,width) to it. Then sort on max_side. Erik On Aug 25, 2009, at 4:00 AM, Constantijn Visinescu wrote: make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.com wrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
Hi Erik Earle, Ahh, I read your mail too fast... Erik Hatcher's method should work. Thanks! Koji Erik Hatcher wrote: You couldn't sort on a multiValued field though. I'd simply index a max_side field, and have the indexing client add a single valued field with max(length,width) to it. Then sort on max_side. Erik On Aug 25, 2009, at 4:00 AM, Constantijn Visinescu wrote: make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.comwrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
Is there a way to have the max_side field only in Solr ...as in a conditional copyField or something like that? I'd like to push as much of this into Solr as I can because the app and db that Solr is indexing are not really the best place to add this type of functionality. - Original Message From: Koji Sekiguchi k...@r.email.ne.jp To: solr-user@lucene.apache.org Sent: Tuesday, August 25, 2009 4:04:29 AM Subject: Re: Solr Query help - sorting Hi Erik Earle, Ahh, I read your mail too fast... Erik Hatcher's method should work. Thanks! Koji Erik Hatcher wrote: You couldn't sort on a multiValued field though. I'd simply index a max_side field, and have the indexing client add a single valued field with max(length,width) to it. Then sort on max_side. Erik On Aug 25, 2009, at 4:00 AM, Constantijn Visinescu wrote: make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.comwrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
If you're using DataImportHandler, a custom (Java or script) transformer could do this. Also an UpdateProcessor could do it. But there is no conditional copyField capabilities otherwise. Keep in mind that pragmatically, if you're doing your own indexing code, why not have a line like this? :) max_side = (length width) ? length : width Erik On Aug 25, 2009, at 2:20 PM, Erik Earle wrote: Is there a way to have the max_side field only in Solr ...as in a conditional copyField or something like that? I'd like to push as much of this into Solr as I can because the app and db that Solr is indexing are not really the best place to add this type of functionality. - Original Message From: Koji Sekiguchi k...@r.email.ne.jp To: solr-user@lucene.apache.org Sent: Tuesday, August 25, 2009 4:04:29 AM Subject: Re: Solr Query help - sorting Hi Erik Earle, Ahh, I read your mail too fast... Erik Hatcher's method should work. Thanks! Koji Erik Hatcher wrote: You couldn't sort on a multiValued field though. I'd simply index a max_side field, and have the indexing client add a single valued field with max(length,width) to it. Then sort on max_side. Erik On Aug 25, 2009, at 4:00 AM, Constantijn Visinescu wrote: make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.comwrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
I am indexing my data both through DataImportHandler and per transaction from JPA using @PostXXX listeners. UpdateRequestProcessor looks like exactly what I need I don't suppose there's a scriptable subclass available in 1.4 that is configured from schema.xml? :-) Thanks guys! - Original Message From: Erik Hatcher erik.hatc...@gmail.com To: solr-user@lucene.apache.org Sent: Tuesday, August 25, 2009 11:26:58 AM Subject: Re: Solr Query help - sorting If you're using DataImportHandler, a custom (Java or script) transformer could do this. Also an UpdateProcessor could do it. But there is no conditional copyField capabilities otherwise. Keep in mind that pragmatically, if you're doing your own indexing code, why not have a line like this? :) max_side = (length width) ? length : width Erik On Aug 25, 2009, at 2:20 PM, Erik Earle wrote: Is there a way to have the max_side field only in Solr ...as in a conditional copyField or something like that? I'd like to push as much of this into Solr as I can because the app and db that Solr is indexing are not really the best place to add this type of functionality. - Original Message From: Koji Sekiguchi k...@r.email.ne.jp To: solr-user@lucene.apache.org Sent: Tuesday, August 25, 2009 4:04:29 AM Subject: Re: Solr Query help - sorting Hi Erik Earle, Ahh, I read your mail too fast... Erik Hatcher's method should work. Thanks! Koji Erik Hatcher wrote: You couldn't sort on a multiValued field though. I'd simply index a max_side field, and have the indexing client add a single valued field with max(length,width) to it. Then sort on max_side. Erik On Aug 25, 2009, at 4:00 AM, Constantijn Visinescu wrote: make a new multivalued field in your schema.xml, copy both width and length into that field, and then sort on that field ? On Tue, Aug 25, 2009 at 5:40 AM, erikea...@yahoo.com erikea...@yahoo.comwrote: Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Solr Query help - sorting
Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C
Re: Solr Query help - sorting
Clever... but if more than one row adds up to the same value I may get the wrong order (like 50, 50 and 10, 90) I need a max function but the one provided only compares against a constant. Sent from my iPhone On Aug 24, 2009, at 6:15 PM, Koji Sekiguchi k...@r.email.ne.jp wrote: How about using sum() FunctionQuery, via: http://localhost:8983/solr/select/?q=_val_%3A%22sum%28width%2Clength%29%22 Thanks, Koji Erik Earle wrote: Suppose I have a database of rectangle attributes that I have indexed in Solr and I want to get the top 10 widest or longest rectangles from one query. name | width | length A | 100| 10 B | 10 | 90 C | 80 | 10 ... My indexed fields are: name, width, length Is there a way to query so that my data returns the order: A, B, C