-
Notifications
You must be signed in to change notification settings - Fork 1
Broaden search result for other sorting than "relevance" (resolves #10) #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,16 @@ final class SearchQueryBuilder extends AbstractQueryBuilder | |
* @param int $storeId | ||
* @param EventDispatcher $eventDispatcher | ||
*/ | ||
public function __construct(SearchString $searchString, FuzzyConfig $fuzzyConfig, ResultsConfig $resultsConfig, AttributeRepository $attributeRepository, Pagination $pagination, ParamsBuilder $paramsBuilder, $storeId, EventDispatcher $eventDispatcher) | ||
{ | ||
public function __construct( | ||
SearchString $searchString, | ||
FuzzyConfig $fuzzyConfig, | ||
ResultsConfig $resultsConfig, | ||
AttributeRepository $attributeRepository, | ||
Pagination $pagination, | ||
ParamsBuilder $paramsBuilder, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I changed this. See also integer-net/solr-pro#7 as I had to do changes to the pro library too due to changed interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't change it to |
||
$storeId, | ||
EventDispatcher $eventDispatcher | ||
) { | ||
parent::__construct($attributeRepository, $pagination, $paramsBuilder, $storeId, $eventDispatcher); | ||
$this->fuzzyConfig = $fuzzyConfig; | ||
$this->resultsConfig = $resultsConfig; | ||
|
@@ -114,6 +122,20 @@ protected function getResultsConfig() | |
return $this->resultsConfig; | ||
} | ||
|
||
public function build() | ||
{ | ||
return new Query( | ||
$this->getStoreId(), | ||
$this->getQueryText(), | ||
0, | ||
$this->getPagination()->getPageSize() * $this->getPagination()->getCurrentPage(), | ||
$this->getParamsBuilder() | ||
->setBroaden($this->broaden) | ||
->setAttributeToReset($this->getAttributetoReset()) | ||
->buildAsArray() | ||
); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood it correctly,
setAttributesToReset
is only needed in one implementation. I think it should not be implemented in the abstract params builder and probably not even used in the abstract query builder then.Here we can easily remove the line and move them to
setAttributeToReset()
above:Then move that method down to the class(es) where it is actually needed and we know that the type of
paramsBuilder
supports it:SearchQueryBuilder
andCategoryQueryBuilder
(?)