How I write a query in Solr that performs "start with" function? For example, if I have 3 documents with the following title fields:
I want the query to return first 2 documents, whose title starts with "Star Wars"
Edit: For the record, this is what I end up using:
fq=(name:"/Apple Ipad.*/")&wt=xml
Define '^' as the first character of a search phrase meaning "Starts With".
Define '$' as the last character of a search phrase meaning "Ends With".
Pre-parse your search phrase, substituting '^' and '$' appropriately.
You can use regular expressions
https://web.archive.org/web/20161030170947/http://www.openjems.com/solr-regex-tutorial/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With