views – Search api Solr add fulltext search fields programmatically

I need to change fields in fulltext search fields programmatically.

I try this codes but nothing change:

function MY_MODULE_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query) {

    $fields = $query->getFulltextFields();
    $fields() = 'field_competitor_code';

}

or this:

function MY_MODULE_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query) {

    $query->setFulltextFields(('title_1', 'field_competitor_code'));

}

How can achieve this change?

Thanks in advance.

F.

7 – solr is running, but the search does not work: "Solr server from Solr could not be reached."

I am using Search API Solr (Version: 7.x-1.14), and the search worked fine but stopped working. I now see "Solr server from Solr could not be reached" in admin / config / search / search_api. In the past, when I received this message, it was because solr had stopped working. In this case, solr is running. I confirmed it with the command "bin / solr status".

My settings should all be correct, as they haven't changed and worked well before:

Solr Host: localhost
Solr port: 8983
Solr path: /solr/drupal

What could prevent Drupal from reaching Solr while no parameters have changed and Solr is running?

research – Modify the SOLR request according to the form checboxes

I use the Search API and Search API SOLR modules to search with SOLR. Now I would like to change the query and I have already learned how to do it. The last thing I need is to allow the user to modify the query via a selection in the checkboxes.

So what I need is:

  1. Add checkboxes to the search form (they cannot change the query, I want it manually)

  2. Find the verified cbs and manually modify the query.

What is the best approach to display user-editable CB? I have tried using the SOLR search page where it is possible to add new filters. But if I understand correctly, this will automatically change the request and I don't want that.

8 – Avoid brutal crashes if the user is looking for the shutdown of Solr

I am using search_api_solr with a Solr installation on a server. Works well. For reasons that I do not explain, the Solr service is sometimes stopped. If a user searches while Solr is stopped, it crashes with "The website encountered an unexpected error."

The error log says "Drupal search_api_solr SearchApiSolrException: an error occurred while searching with the Solr endpoint: Solr http: // localhost: 8983 / inaccessible or returned unexpected response code" 0 "." No surprise, since the service is stopped.

How can I catch this error and display a "Search doesn't work" page instead of crashing? It seems like there should be a way to intercept it, but I didn't understand it.

Solr search does not return content type

I have a site configured with Solr search. Drupal says that 100% of the site is indexed and that search seems to work for most types of content and their fields. However, the search does not appear to search for all fields of the "Publications" content type.

For example, the second item in the list of publications (Title = "Bibliography of dry valleys …") has the following text in the "Bibliographic citation" field:

Mead, Kay L. Bibliography of publications on dry valleys produced under
under the auspices of the New Zealand Antarctic Research Program 1959-1976 1977

However, when I search for "Mead" in the Solr search, I don't get "no results found". The same with "overseas", which appears in the publication summary.

However, if I search for "aegis" that appears in the title, the publication is returned.

How can I ask Solr to index the other fields?

search – How to query the solr server from php in Drupal 8

How to query the Solr server from PHP in Drupal 8?

I installed search_api, search_api_solr and search_api_attachments. Solr v.8.4.0 is also installed.

I installed php SolrClient for Centos 7 following these tips: https://stackoverflow.com/questions/22959330/fatal-error-class-solrclient-not-found
, but I still get "“SolrClient” class not found"whenever I run

new SolrClient($options);

I found documentation on querying Solr from php in Drupal 7 (apachesolr_get_solr ()) but nothing in Drupal 8.

apache – Solr, how to boost based on 2 conditions

If I need to boost the most recent documents first, I can use

bf = recip (rord (creationDate), 1,1000,1000)

OR

bq = {! func} recipe (rord (creationDate), 1,1000,1000)

But I have to add another condition to this: I want to increase only recent documents whose price is between 1 and 100. How can I do that?

Unable to index and search in Drupal7 attachments with the help of Solr 4.9

After configuring the server and the index (Attchment: the File field has been added), I can search and query the body, Content Description D7 except Attachment (neither title nor content) of the Solr panel in the browser.
Other documents and videos suggest that indexing and searching in attachments be done without tinkering with Tika.
Please suggest a solution.
Env: Solr 4.9.1 and Drupal 7
Modules installed and activated in D7:
Search API: 7.x
Research attachment: 7.x
Apache Solr Access: 7.x

8 – Search Solr Show with filter exposed fullsearch do not return any results

I have configured a Solr search index (Solr 7.7.1 and Search API Solr 3.2) with custom entities. I have several indexed fields and 2 of them are in full text. Aditionally:

  • I configured the view with a filter exposed in a block (page view)
  • No Ajax option is defined
  • I have a filter Search enabled: Full-text search with the following options:
    • Expose this filter to visitors
    • Signle filter
    • Contains none of these words
    • Allow multiple selections
    • Analysis mode: direct query
    • All selected Fulltext fields
  • Form settings exposed
    • Blocked form: YES
    • Presentation for the style: basic
  • I also install facets on other fields

When I come to the page, all results are displayed by default. When I search for one or more terms via the Full Text text field, the results are empty. Instead, if I select some facet options, the results are displayed accordingly for the facets.

How can I make the Fulltext search work?

Sort by date with the results of Solr Search API

I'm creating a publication notes section for my website in which I retrieve a paragraph of the specific content type.
I've set up an index with fields such as name or status. In addition to that, I added the date field that is part of the paragraph.

I've created a view that should display all sources of content data from this search API index.

Everything is ok with the list of hundreds of release notes, the release notes are well displayed, but sorting is a problem.

First, I can not add a sort field to the display page because I do not see any options regarding the granularity of the sorting date (it's just the data source of the content).

Second, I installed the Search API Sorts module, but it allows sorting only by Integer or String so that the Date field is not supported at all.

Third, I put the primary function:

/**
* Implements hook_search_api_solr_query_alter().
*/
function search_api_sorts_search_api_solr_query_alter(Query 
 $solarium_query, QueryInterface $query) {

 $dateField = 'field_publish';
$index = $query->getIndex();
  $fields = $index->getServerInstance()
   ->getBackend()
  ->getSolrFieldNames($index);
  $solrField = !empty($fields($dateField)) ? $fields($dateField) : '';

  if ($solrField) {
      $solarium_query->addParam('bf', "recip(abs(ms(NOW, {$solrField})),3.16e- 
 11,10,0.1)");
 }

But I have an error

HTTP Status 400 Error Report – can not use FieldCache on a multi-valued field: dm_field_publish

Do you have any ideas on how to solve this problem or a workaround on sorting paragraphs by date?
Thanks in advance!