Take the 2-minute tour ×

I have to modify a query that searches for a value starting with a letter (relevant snippet fo the query): &fq=Organization:"+letter+"*&

If I pass 'A' as the letter param I'll get 'ABC Hardware', something that start with an A.

How would i modify the letter variable to return only something that starts with a number, as '1A Widgets'.

Tried things like letter = '[0 TO 5]', but I honestly have no idea if I'm on the right track with that.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Seems like a dupe of this question

For cases like this, my favourite approach is to index another boolean field called "StartsWithNumber" and then it's a simple boolean filter. This might not work for you if you can't reindex all of your documents.

For a brute force approach, you could do something like:

fq=Organization:0* OR Organization:1* OR Organization:2* OR .. etc

Not pretty, but fq's get cached so at least it should be fast.

share|improve this answer
Brute is good, thanks for saving the day :-), sorry about the dupe questions if that's the case, didn't realize it. –  vector Nov 11 '11 at 20:21
add comment

Your Answer


