Hi all,
I am new to Bleve. Excited to see a text indexing and search library which is very easy to use and with a wide variety of functions in Golang.
I have a newbie question. Hope this community can help me. Apologies if I've missed the obvious.
I am looking for a way to do a partial phrase match.
Example:
String to be indexed: Harry Potter and the Cursed Child
SearchTerm: harry p
I am trying to make the above search term match the indexed document.
I have a custom analyzer with a whitespace tokenizer, to_lower token filter.
I've tried a couple of things, but haven't been able to get this working.
Option #1
query1= NewMatchQuery("harry")
query2= NewWildcardQuery("p*)
finalQuery =NewBooleanQuery()
query1.AddMust(query1)
query1.AddMust(query2)
This is able to match "Harry Potter and the Cursed Child" but it also matches terms like "Prince Harry" (order of terms is not maintained).
Option #2
I also tried a regex query with regex expression:
finalWord := "/.*" + firstSearchTerm + " " + secondSearchTerm + ".*/"
In Lucene, I had used SpanQuery with 0 distance between the two to achieve the above.
query1 = SpanTermQuery(word1)
query2 = SpanMultiTermQueryWrapper(new WildcardQuery(word2+"*"))
finalQuery = SpanNearQuery(query1, query2, 0)
I've also tried PrefixQuery, MatchPhraseQuery. PrefixQuery seems to be working only for a single word searchTerm and MatchPhraseQuery needs the whole word to match.
Please let me know if you know a solution to my problem.