I am trying implement an alphabetical range to perform a query in Solr 3.3.
The user wants to fetch a list of restaurants which names start with (for example) A to G. Tried with “frange” function but it includes every field that has the letter. I want to get the restaurants wich names START with a specific letter.
Something like: “Get all restaurants from A to G”: (A* and G*) but not (a and g).
Thank you
Use
name:[a TO h]wherenamefield is not tokenized. If required, create a separate copy of the field for this.If you try this on a tokenized field, then it will match all names which contain a word which starts with one of these letters. Also, you need to ‘increment’ the last letter of the range. If it is
z, then replace it with*. For example, if the user is looking forwtozthen the query should bename:[w TO *].