Re: Reverse range search
Hi, I think I have seen a comment on the list from someone with the same need a few months ago. He planned to make a new fieldType to support this, e.g. MinMaxRangeFieldType which would be a polyField type holding both a min and max value, and then you could query it q=myminmaxfield:123 I did not find it as a Jira issue however, but I can see how it would be useful for a lot of usecases. Perhaps you can create a Jira issue for it and supply a patch? :) -- Jan Høydahl, search solution architect Cominvent AS - www.cominvent.com On 28. okt. 2010, at 23.24, kenf_nc wrote: Doing a range search is straightforward. I have a fixed value in a document field, I search on [x TO y] and if the fixed value is in the range requested it gets a hit. But, what if I have data in a document where there is a min value and a max value and my query is a fixed value and I want to get a hit if the query value is in that range. For example: Solr Doc1: field min_price:100 field max_price:500 Solr Doc2: field min_price:300 field max_price:500 and my query is price:250. I could create a query of (min_price:[* TO 250] AND max_price:[250 TO *]) and that should work. It should find only doc 1. However, if I have several fields like this and complex queries that include most of those fields, it becomes a very ugly query. Ideally I'd like to do something similar to what the spatial contrib guys do where they make lat/long a single point. If I had a min/max field, I could call it Price (100, 500) or Price (300,500) and just do a query of Price:250 and Solr would see if 250 was in the appropriate range. Looong question short...Is there something out there already that does this? Does anyone else do something like this and have some suggestions? Thanks, Ken -- View this message in context: http://lucene.472066.n3.nabble.com/Reverse-range-search-tp1789135p1789135.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reverse range search
I wonder if function queries might help you here (be aware that these aren't my strong point though). See: http://wiki.apache.org/solr/FunctionQuery http://wiki.apache.org/solr/FunctionQueryBest Erick On Thu, Oct 28, 2010 at 5:24 PM, kenf_nc ken.fos...@realestate.com wrote: Doing a range search is straightforward. I have a fixed value in a document field, I search on [x TO y] and if the fixed value is in the range requested it gets a hit. But, what if I have data in a document where there is a min value and a max value and my query is a fixed value and I want to get a hit if the query value is in that range. For example: Solr Doc1: field min_price:100 field max_price:500 Solr Doc2: field min_price:300 field max_price:500 and my query is price:250. I could create a query of (min_price:[* TO 250] AND max_price:[250 TO *]) and that should work. It should find only doc 1. However, if I have several fields like this and complex queries that include most of those fields, it becomes a very ugly query. Ideally I'd like to do something similar to what the spatial contrib guys do where they make lat/long a single point. If I had a min/max field, I could call it Price (100, 500) or Price (300,500) and just do a query of Price:250 and Solr would see if 250 was in the appropriate range. Looong question short...Is there something out there already that does this? Does anyone else do something like this and have some suggestions? Thanks, Ken -- View this message in context: http://lucene.472066.n3.nabble.com/Reverse-range-search-tp1789135p1789135.html Sent from the Solr - User mailing list archive at Nabble.com.
Reverse range search
Doing a range search is straightforward. I have a fixed value in a document field, I search on [x TO y] and if the fixed value is in the range requested it gets a hit. But, what if I have data in a document where there is a min value and a max value and my query is a fixed value and I want to get a hit if the query value is in that range. For example: Solr Doc1: field min_price:100 field max_price:500 Solr Doc2: field min_price:300 field max_price:500 and my query is price:250. I could create a query of (min_price:[* TO 250] AND max_price:[250 TO *]) and that should work. It should find only doc 1. However, if I have several fields like this and complex queries that include most of those fields, it becomes a very ugly query. Ideally I'd like to do something similar to what the spatial contrib guys do where they make lat/long a single point. If I had a min/max field, I could call it Price (100, 500) or Price (300,500) and just do a query of Price:250 and Solr would see if 250 was in the appropriate range. Looong question short...Is there something out there already that does this? Does anyone else do something like this and have some suggestions? Thanks, Ken -- View this message in context: http://lucene.472066.n3.nabble.com/Reverse-range-search-tp1789135p1789135.html Sent from the Solr - User mailing list archive at Nabble.com.