Question

I am new to SOLR so bear with me. So there are a bunch of hotels in different countries in the world and you can search for them from any location. For example, there could be a hotel in Tokyo and I could be searching for this hotel in London or even Tokyo itself or in New York.

The query I am trying to create is to search for a hotel and return the one based on the market/country I am in but also return the results from different markets/countries. For example, if I am in the UK the market would be GB and it would return results based on GB, which should be placed highest in the result whilst including the other markets such as JP (Japan) but their results being placed lower.

The query I am so far is this (which doesn't work):

q=&fl=*&rows=1&sort=query({!qf=market v='GB'}) desc,
totalPrice asc
&fq=hotelCheckInDate:[2014-02-20T00:00:00.000Z TO 2014-07-20T23:59:59.9999Z] 
AND hotelCityCode:PAR

I can easily do a market:GB but this would return only the GB market.

How should I structure this query to get the results that I want?

No correct solution

OTHER TIPS

Hope this query will help you get the result expected

q=*:*&defType=edismax&bq=market:GB^2&fq=hotelCheckInDate:[2014-02-20T00:00:00.000Z TO 2014-07-20T23:59:59.9999Z] AND hotelCityCode:PAR

In your query, you have mentioned rows=1. It means, even there are more than one result, you'll get a single result only.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top