1
votes

I've got a business case where I need to check if the search query is about displays businesses

eg: q="night clubs new york"

I've got a list of Countries, state city and region in my database 3million + records and I've got a list of business categories.

All I want to do is check if in the query has a business category in it (night clubs) and does it have a City, state or country's name (new york). So i'm checking the number of results retuned for the below query. If I get 2 numResults then this is a business query and then I query my Solr index to search for businesses.

query: places_ss:(night clubs new york) OR categories_ss:(night clubs new york)

Speed Question: How should I save the list of cities, states and countries in SOLR to get maximum search speed ?

  • Have one document id:places and add distinct cities, states and countries in on array places_ss
  • have multiple documents with different id's with 100,000 place names in each document in an array. ?
  • have a document or multiple documents with place_s string(not array) each place separated by space and each space in place separated by underscore eg: new york becomes new_york. And during query time I will get multiple combinations of night clubs new york

    eg: night night_clubs night_clubs_new night_clubs_new_york clubs_new clubs_new_york new_york york and query for place.

Would it be a good idea to have a separate core just for above place documents to increase speed ?

Is this a good solution ?

1

1 Answers

0
votes

Document organisation : better to have a document approche with : - location - activity - other things needed!

location You should save your location like this Country:state:city:suburb.... so that you can seach in usa:new york:new york* of ::new york

No need for _ avoid that, there is no needs !

activity activity should be stored in another field for precision on the search and speed.