Reputation: 1158
I am searching data which matches only that sentence which starts with the search key.
Ex:
search key "what"
result : DESIRED ONE
**what** is your name
**what** are you doing
**what** is that
etc.
How i am getting now is
Is that **what** you want
some text before **what**
etc.
i am using EdgeNGram as well..But it is giving me the second one. Any help appreciated....
Upvotes: 1
Views: 1842
Reputation: 193
You can use a regex 'starts with query' q:(name:/what.*/)
will yield results where the name field start with 'what'
Upvotes: 2
Reputation: 3149
I think you can use the following trick: add the following line to your field definition:
<charFilter class="solr.PatternReplaceCharFilterFactory"
pattern="^(.*)$" replacement="AAAA $1" />
This will add the "AAAA" token to both your index and query. This way you can match the beginning of an indexed string.
More info here:
Upvotes: 0