Hello,
I have created a solr backend extending SearchApiSolrBackend class.

Since Drupal\search_api_attachments\Plugin\search_api_attachments\SolrExtractor has the backends keys hardcoded, my backend won't show in the option list.


public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = [];
$conditions = [
'status' => TRUE,
'backend' => [
'search_api_solr',
'search_api_solr_acquia',
'search_api_solr_acquia_multi_subs',
],
];
.......

Is there any logic that we can do here for showing it?

The only way I have found is to comment the 'backend' key out from the array.

Thanks in advance.

Comments

TuWebO created an issue. See original summary.

tuwebo’s picture

Added patch that removes the backend condition, show any available backends will be shown in the option list.

tuwebo’s picture

Status: Active » Needs review

Sorry, I've forgot to change issue status.

mkalkbrenner’s picture

Since Search API Solr introduced Connectors, the use-cases for implementeng own backends should be very rare.
For example the Acquia Search connector doesn't provide it's own backend anymore but a Connector plugin.

Anyway, hard-coding the backends here is a bad thing. At least that is a blocker for Search API Solr Multilingual.

mkalkbrenner’s picture

I got the idea that you want to limit the selection to Solr based servers, and not database backends for example.
The right fix would be to load all servers and iterate over them to check if they implement Drupal\search_api_solr\SolrBackendInterface

mkalkbrenner’s picture

Title: Allow backend configuration to select backends extending SearchApiSolrBackend » Allow backend configuration to select backends implementing SolrBackendInterface
Category: Feature request » Bug report
Priority: Normal » Major
Status: Needs review » Needs work
Related issues: +#2730061: Test multilingual support for attachments
mkalkbrenner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.5 KB
tuwebo’s picture

Hi @mkalkbrenner,
Thank you very much for the review. Exactly, what I ment (or tried to) is what you said in comment #5 #2809083-5: Allow backend configuration to select backends implementing SolrBackendInterface.
I confirm that patch in #7 works fine for me.

Thanks.

tuwebo’s picture

Sorry, I din't mention my use case:

class MySearchApiSolrBackend extends SearchApiSolrBackend {

  protected function preQuery(Query $solarium_query, QueryInterface $query) {
    // Do some things based on $query->getSearchId(FALSE);
    // $solarium_query->getEDisMax()->addBoostQueries($bqs);
  }

  public function supportsDataType($type) {
    // Add my datypes
  }
}

Don't know if this is the best solution, but I am able to select this backend with the patch #7 applied.

mkalkbrenner’s picture

Status: Needs review » Reviewed & tested by the community

according to #8

  • izus committed fb8b064 on 8.x-1.x authored by mkalkbrenner
    Issue #2809083 by TuWebO, mkalkbrenner, izus: Allow backend...
izus’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed

Thanks all.
This is now merged and will be part of today's release ( first beta)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.