Goal: execute fuzzy search, then wildcard search with those similar terms
I have a boolean query in place at the moment, shown below:
$query = new Zend_Search_Lucene_Search_Query_Boolean();
$pattern = new Zend_Search_Lucene_Index_Term("*$string*");
$subquery1 = new Zend_Search_Lucene_Search_Query_Wildcard($pattern);
$term = new Zend_Search_Lucene_Index_Term("$string");
$subquery2 = new Zend_Search_Lucene_Search_Query_Fuzzy($term);
$query->addSubquery($subquery1, null /* optional */);
$query->addSubquery($subquery2, null /* optional */);
$hits = $index->find($query);
This seems to be executing an either/or search. For example: if I search for the term
"berry"
I hit everything with "berry" anywhere in the title
berry, wild berry, strawberry, blueberry
But if I search for
"bery"
I only hit results like
berry
I'm not exactly sure how the fuzzy search is powered. Is there a way to modify my query so that I can wildcard search after the fuzzy search returns the similar terms?